|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2007-10-31 13:23 UTC] ryat at wolvez dot org
Description: ------------ GET date variable name not binary-safe on null bytes Reproduce code: --------------- <?php print_r($_GET); ?> http://127.0.0.1/test.php?a%00aaaa=test Actual result: -------------- Array ( [a] => test ) PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sat Oct 25 23:00:01 2025 UTC |
> And why would you want to pass null byte in the parameter name? Because it's allowed to use "%00" in a query_string ;-) In $_SERVER['QUERY_STRING'] you have the correct value. It's also allowed, and works, to use "\0" as array key: | $a = array("a\0aaaa" => "test"); | echo $a["a\0aaaa"].PHP_EOL; | echo strlen(key($a)); prints: | test | 6 This also works: | $s = 'a%00aaaa=test'; | $s = rawurldecode($s); | $t = explode('=', $s); | $a[$t[0]] = $t[1]; | unset($t); | var_dump($a); But this not: | $s = 'a%00aaaa=test'; | $s = rawurldecode($s); | parse_str($s, $a); | var_dump($a); Maybe the problem is: With a possible "register_globals = on" or only "parse_str($s);", you have an illegal variable name? So, that is a bug, but maybe a "won't fix" and should be described in the manual? Regards, Carsten