Bug #76255 [NEW]: parse_str() does not replace control characters

From: Date: Mon, 23 Apr 2018 18:26:44 +0000
Subject: Bug #76255 [NEW]: parse_str() does not replace control characters
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-214846@lists.php.net to get a copy of this message
From: alex dot a dot pott at gmail dot com Operating system: OS X & Linux PHP version: 7.2.4 Package: URL related Bug Type: Bug Bug description:parse_str() does not replace control characters Description: ------------ If you manually extract the query string from http://example.com?foo=bar&\x00foo=bar2&foo=bar3 and then use parse_str() on the result it is different than if you use parse_url() and then parse_str(). This is loosely related to https://bugs.php.net/bug.php?id=66976. Test script: --------------- $url = "http://example.com?foo=bar&\x00foo=bar2&foo=bar3"; list($path, $query_string) = explode('?', $url, 2); // Use parse_url() and then parse_str() $parts = parse_url($url); parse_str($parts['query'], $parsed_qs); var_dump($parsed_qs); // Ouptput: array(2) { // ["foo"]=> // string(4) "bar3" // ["_foo"]=> // string(4) "bar2" //} // Use parse_str() parse_str($query_string, $parsed_qs); var_dump($parsed_qs); // Output: array(1) { // ["foo"]=> // string(3) "bar" // } Expected result: ---------------- I expect the second result to be the same as the first. -- Edit bug report at https://bugs.php.net/bug.php?id=76255&edit=1 -- Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=76255&r=trysnapshot54 Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=76255&r=trysnapshot55 Try a snapshot (trunk): https://bugs.php.net/fix.php?id=76255&r=trysnapshottrunk Fixed in SVN: https://bugs.php.net/fix.php?id=76255&r=fixed Fixed in release: https://bugs.php.net/fix.php?id=76255&r=alreadyfixed Need backtrace: https://bugs.php.net/fix.php?id=76255&r=needtrace Need Reproduce Script: https://bugs.php.net/fix.php?id=76255&r=needscript Try newer version: https://bugs.php.net/fix.php?id=76255&r=oldversion Not developer issue: https://bugs.php.net/fix.php?id=76255&r=support Expected behavior: https://bugs.php.net/fix.php?id=76255&r=notwrong Not enough info: https://bugs.php.net/fix.php?id=76255&r=notenoughinfo Submitted twice: https://bugs.php.net/fix.php?id=76255&r=submittedtwice register_globals: https://bugs.php.net/fix.php?id=76255&r=globals PHP 4 support discontinued: https://bugs.php.net/fix.php?id=76255&r=php4 Daylight Savings: https://bugs.php.net/fix.php?id=76255&r=dst IIS Stability: https://bugs.php.net/fix.php?id=76255&r=isapi Install GNU Sed: https://bugs.php.net/fix.php?id=76255&r=gnused Floating point limitations: https://bugs.php.net/fix.php?id=76255&r=float No Zend Extensions: https://bugs.php.net/fix.php?id=76255&r=nozend MySQL Configuration Error: https://bugs.php.net/fix.php?id=76255&r=mysqlcfg

« previous php.bugs (#214846) next »