mirror of
https://github.com/php/php-src.git
synced 2026-03-24 00:02:20 +01:00
Fix #78236: convert error on receiving variables when duplicate [
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.
This commit is contained in:
@@ -178,8 +178,14 @@ PHPAPI void php_register_variable_ex(const char *var_name, zval *val, zval *trac
|
||||
} 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) {
|
||||
|
||||
Reference in New Issue
Block a user