From: me at anton dot in dot ua Operating system: Windows Vista/Ubuntu PHP version: 5.2.10 PHP Bug Type: URL related Bug description: parse_url convert \r\n to _ _
Description: ------------ parse_url convert \r\n symbols to _ _. More: OK: $string = "ftp://login:p...@domain"; array 'scheme' => string 'ftp' (length=3) 'host' => string 'domain' (length=6) 'user' => string 'login' (length=5) 'pass' => string 'pass' (length=4) BUG: $string ="ftp://login:p...@domain\r\n"; array 'scheme' => string 'ftp' (length=3) 'host' => string 'domain__' (length=8) /* wtf? */ 'user' => string 'login' (length=5) 'pass' => string 'pass' (length=4) ------------ if i get strings from file i should use trim before use parse_url. i think it is bug and parse_url should use trim - OR - ignore \r\n at the end of line. Reproduce code: --------------- $string = "ftp://login:p...@domain"; var_dump(parse_url($string)); $string = "ftp://login:p...@domain\r\n"; var_dump(parse_url($string)); Expected result: ---------------- array 'scheme' => string 'ftp' (length=3) 'host' => string 'domain' (length=6) 'user' => string 'login' (length=5) 'pass' => string 'pass' (length=4) Actual result: -------------- array 'scheme' => string 'ftp' (length=3) 'host' => string 'domain__' (length=8) /* wtf? */ 'user' => string 'login' (length=5) 'pass' => string 'pass' (length=4) -- Edit bug report at http://bugs.php.net/?id=49055&edit=1 -- Try a snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=49055&r=trysnapshot52 Try a snapshot (PHP 5.3): http://bugs.php.net/fix.php?id=49055&r=trysnapshot53 Try a snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=49055&r=trysnapshot60 Fixed in SVN: http://bugs.php.net/fix.php?id=49055&r=fixed Fixed in SVN and need be documented: http://bugs.php.net/fix.php?id=49055&r=needdocs Fixed in release: http://bugs.php.net/fix.php?id=49055&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=49055&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=49055&r=needscript Try newer version: http://bugs.php.net/fix.php?id=49055&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=49055&r=support Expected behavior: http://bugs.php.net/fix.php?id=49055&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=49055&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=49055&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=49055&r=globals PHP 4 support discontinued: http://bugs.php.net/fix.php?id=49055&r=php4 Daylight Savings: http://bugs.php.net/fix.php?id=49055&r=dst IIS Stability: http://bugs.php.net/fix.php?id=49055&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=49055&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=49055&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=49055&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=49055&r=mysqlcfg