#44456 [NEW]: CURLOPT_URL error in parsing ftp url string given

From: Date: Mon, 17 Mar 2008 16:27:31 +0000
Subject: #44456 [NEW]: CURLOPT_URL error in parsing ftp url string given
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-123385@lists.php.net to get a copy of this message
From: sergiocrz at hotmail dot com Operating system: WinXP PHP version: 5.2.5 PHP Bug Type: cURL related Bug description: CURLOPT_URL error in parsing ftp url string given Description: ------------ When an ftp username or password uses the character "#" and when I try to use it in curl_setopt($ch, CURLOPT_URL, "ftp://$ftp_user_name:$ftp_pass@$ftp_ip:$ftp_port$path"); cURL will not login with the correct user/pass combination nor the correct IP. Reproduce code: --------------- // using ex: ftp://%e$U^&:!@#$5%@123.145.123.145:456 $ftp_user_name = "%e$U^&" ; $ftp_pass = "!@#$5%" ; $ftp_ip = "123.145.123.145"; $ftp_port = 456; $path = "/"; $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, "ftp://$ftp_user_name:$ftp_pass@$ftp_ip:$ftp_port$path"); curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 4); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_FTPLISTONLY, 0); $result['filelist'] = curl_exec($ch); // content $result['error'] = curl_error($ch); $result['errno'] = curl_errno($ch); Expected result: ---------------- Loggin in with the correct $ftp_user_name = "%e$U^&" ; $ftp_pass = "!@#$5%" ; $ftp_ip = "123.145.123.145"; $ftp_port = 456; Actual result: -------------- cURL will connect to the IP: #$5%@123.145.123.145 as dysplayed by the error. As you can see the part before the ip "#$5%" belongs to the ftp_pass, so I think when curl is parsing the url string and encounters "#" (char(35)) it returns the wrong ip. -- Edit bug report at http://bugs.php.net/?id=44456&edit=1 -- Try a CVS snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=44456&r=trysnapshot52 Try a CVS snapshot (PHP 5.3): http://bugs.php.net/fix.php?id=44456&r=trysnapshot53 Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=44456&r=trysnapshot60 Fixed in CVS: http://bugs.php.net/fix.php?id=44456&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=44456&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=44456&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=44456&r=needscript Try newer version: http://bugs.php.net/fix.php?id=44456&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=44456&r=support Expected behavior: http://bugs.php.net/fix.php?id=44456&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=44456&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=44456&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=44456&r=globals PHP 4 support discontinued: http://bugs.php.net/fix.php?id=44456&r=php4 Daylight Savings: http://bugs.php.net/fix.php?id=44456&r=dst IIS Stability: http://bugs.php.net/fix.php?id=44456&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=44456&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=44456&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=44456&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=44456&r=mysqlcfg

« previous php.bugs (#123385) next »