When an input variable name contains a non matched open bracket, we not
only have to replace that with an underscore, but also all following
forbidden characters.
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
?? ??? ????, PHP 8.0.0beta1
+- Core:
+ . Fixed bug #78236 (convert error on receiving variables when duplicate [).
+ (cmb)
+
- JIT:
. Fixed bug #79864 (JIT segfault in Symfony OptionsResolver). (Dmitry)
} else {
ip = strchr(ip, ']');
if (!ip) {
- /* PHP variables cannot contain '[' in their names, so we replace the character with a '_' */
+ /* not an index; un-terminate the var name */
*(index_s - 1) = '_';
+ /* PHP variables cannot contain ' ', '.', '[' in their names, so we replace the characters with a '_' */
+ for (p = index_s; *p; p++) {
+ if (*p == ' ' || *p == '.' || *p == '[') {
+ *p = '_';
+ }
+ }
index_len = 0;
if (index) {
--- /dev/null
+--TEST--
+Bug #78236 (convert error on receiving variables when duplicate [)
+--POST--
+id[name=1&id[[name=a&id[na me.=3
+--FILE--
+<?php
+var_dump($_POST);
+?>
+--EXPECT--
+array(3) {
+ ["id_name"]=>
+ string(1) "1"
+ ["id__name"]=>
+ string(1) "a"
+ ["id_na_me_"]=>
+ string(1) "3"
+}