Bug #68296 [Com]: \n in path with parse_url() converts to underscore
Edit report at https://bugs.php.net/bug.php?id=68296&edit=1
ID: 68296
Comment by: simonsimcity at gmail dot com
Reported by: dave at lyte dot id dot au
Summary: \n in path with parse_url() converts to underscore
Status: Open
Type: Bug
Package: URL related
Operating System: OS X
PHP Version: 5.4.34
Block user comment: N
Private report: N
New Comment:
Is related to #68296
Previous Comments:
------------------------------------------------------------------------
[2014-10-24 06:14:15] dave at lyte dot id dot au
Description:
------------
Basically if you're parsing a random HTML sometimes users will put new lines in the href
attribute of a tags, browsers ignore the new line, but PHP converts it to an underscore.
Test script:
---------------
$ php -r 'var_export(parse_url("http://example.com/foo\nbar"));'
Expected result:
----------------
The expected output is:
$ php -r 'var_export(parse_url("http://example.com/foo\nbar"));'
array (
'scheme' => 'http',
'host' => 'example.com',
'path' => '/foobar',
)
Actual result:
--------------
The actual output is:
$ php -r 'var_export(parse_url("http://example.com/foo\nbar"));'
array (
'scheme' => 'http',
'host' => 'example.com',
'path' => '/foo_bar',
)
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=68296&edit=1
Thread (6 messages)