#49055 [Opn->Bgs]: parse_url() converts \r\n to _ _
| From: | jani@php.net | Date: | Sat, 25 Jul 2009 10:54:30 +0000 |
| Subject: | #49055 [Opn->Bgs]: parse_url() converts \r\n to _ _ | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-140231@lists.php.net to get a copy of this message | ||
ID: 49055
Updated by: jani@php.net
Reported By: me at anton dot in dot ua
-Status: Open
+Status: Bogus
Bug Type: URL related
Operating System: *
PHP Version: 5.2.10
New Comment:
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to
report
a bug at http://bugs.php.net/how-to-report.php
Someone might expect them to be there. Doing trim() is quite easy if
you
don't want them to be replaced.
Previous Comments:
------------------------------------------------------------------------
[2009-07-25 09:58:14] me at anton dot in dot ua
Description:
------------
parse_url convert \r\n symbols to _ _.
More:
OK:
$string = "ftp://login:pass@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:pass@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:pass@domain";
var_dump(parse_url($string));
$string = "ftp://login:pass@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 this bug report at http://bugs.php.net/?id=49055&edit=1