Bug #68296 [NEW]: \n in path with parse_url() converts to underscore
From: dave at lyte dot id dot au
Operating system: OS X
PHP version: 5.4.34
Package: URL related
Bug Type: Bug
Bug description:\n in path with parse_url() converts to underscore
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 bug report at https://bugs.php.net/bug.php?id=68296&edit=1
--
Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=68296&r=trysnapshot54
Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=68296&r=trysnapshot55
Try a snapshot (trunk): https://bugs.php.net/fix.php?id=68296&r=trysnapshottrunk
Fixed in SVN: https://bugs.php.net/fix.php?id=68296&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=68296&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=68296&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=68296&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=68296&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=68296&r=support
Expected behavior: https://bugs.php.net/fix.php?id=68296&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=68296&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=68296&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=68296&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=68296&r=php4
Daylight Savings: https://bugs.php.net/fix.php?id=68296&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=68296&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=68296&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=68296&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=68296&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=68296&r=mysqlcfg
Thread (6 messages)
- dave at lyte dot id dot au