Skip to content

Commit e865bc2

Browse files
committed
fix bug #30442 ( segmentation fault when parsing ?getvariable[][ )
1 parent d608f1a commit e865bc2

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

main/php_variables.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,11 @@ PHPAPI void php_register_variable_ex(char *var, zval *val, pval *track_vars_arra
133133
if (!ip) {
134134
/* PHP variables cannot contain '[' in their names, so we replace the character with a '_' */
135135
*(index_s - 1) = '_';
136-
index_len = var_len = strlen(index);
136+
137+
index_len = var_len = 0;
138+
if (index) {
139+
index_len = var_len = strlen(index);
140+
}
137141
goto plain_var;
138142
return;
139143
}

0 commit comments

Comments
 (0)