[php-src] Issue #8639: parse_str - replacing dot and space with underscore in keys

From: Date: Thu, 26 May 2022 23:48:49 +0000
Subject: [php-src] Issue #8639: parse_str - replacing dot and space with underscore in keys
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-241595@lists.php.net to get a copy of this message
Issue: https://github.com/php/php-src/issues/8639 Author: otsch ### Description I just remembered this behavior when using parse_str(), that dots and spaces in query string keys are replaced with underscore, for the reason that those aren't allowed in PHP variable names. From PHP 8 on the second argument $result is mandatory, so I think it now doesn't create variables in any case, right? So to me, replacing those characters in the resulting array keys, seems like a leftover that could be removed? ## Example: ```php <?php parse_str('foo.bar =baz', $array); var_dump($array); ``` ### Currently results in: ``` array(1) { ["foo_bar_"]=> string(3) "baz" } ``` ### Maybe better? ``` array(1) { ["foo.bar "]=> string(3) "baz" } ``` ### PHP Version PHP 8 ### Operating System _No response_

« previous php.bugs (#241595) next »