diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/sp_var_value.c | 5 | ||||
| -rw-r--r-- | src/tests/disabled_function_local_var_crash.phpt | 18 |
2 files changed, 23 insertions, 0 deletions
diff --git a/src/sp_var_value.c b/src/sp_var_value.c index a3eed3e..05598bf 100644 --- a/src/sp_var_value.c +++ b/src/sp_var_value.c | |||
| @@ -27,6 +27,11 @@ static zval *get_local_var(zend_execute_data *ed, const char *var_name) { | |||
| 27 | EG(current_execute_data) = current; | 27 | EG(current_execute_data) = current; |
| 28 | zend_array *symtable = zend_rebuild_symbol_table(); | 28 | zend_array *symtable = zend_rebuild_symbol_table(); |
| 29 | 29 | ||
| 30 | if (UNEXPECTED(symtable == NULL)) { | ||
| 31 | EG(current_execute_data) = orig_execute_data; | ||
| 32 | return NULL; | ||
| 33 | } | ||
| 34 | |||
| 30 | ZEND_HASH_FOREACH_STR_KEY_VAL(symtable, key, value) { | 35 | ZEND_HASH_FOREACH_STR_KEY_VAL(symtable, key, value) { |
| 31 | if (0 == strcmp(var_name, key->val)) { | 36 | if (0 == strcmp(var_name, key->val)) { |
| 32 | if (Z_TYPE_P(value) == IS_INDIRECT) { | 37 | if (Z_TYPE_P(value) == IS_INDIRECT) { |
diff --git a/src/tests/disabled_function_local_var_crash.phpt b/src/tests/disabled_function_local_var_crash.phpt new file mode 100644 index 0000000..8dec946 --- /dev/null +++ b/src/tests/disabled_function_local_var_crash.phpt | |||
| @@ -0,0 +1,18 @@ | |||
| 1 | --TEST-- | ||
| 2 | Disable functions - match on a local variable | ||
| 3 | --SKIPIF-- | ||
| 4 | <?php if (!extension_loaded("snuffleupagus")) die "skip"; ?> | ||
| 5 | --INI-- | ||
| 6 | sp.configuration_file={PWD}/config/disabled_function_local_var.ini | ||
| 7 | --FILE-- | ||
| 8 | <?php | ||
| 9 | function test(){ | ||
| 10 | echo strlen("id") . "\n"; | ||
| 11 | } | ||
| 12 | ob_start(test()); | ||
| 13 | echo "test\n"; | ||
| 14 | ?> | ||
| 15 | --EXPECTF-- | ||
| 16 | 2 | ||
| 17 | test | ||
| 18 | |||
