diff options
| author | Andrei Zmievski <andrei@php.net> | 2000-02-11 21:14:42 +0000 |
|---|---|---|
| committer | Andrei Zmievski <andrei@php.net> | 2000-02-11 21:14:42 +0000 |
| commit | a60e91b31351146caa1d0a15ff60c9029ea8654f (patch) | |
| tree | f3f8026c12959e9fb6f945095d62d0739de5df40 /ext/standard/basic_functions.c | |
| parent | 94be61fde5f580b305537b54df17b0257ed1378f (diff) | |
| download | php-git-a60e91b31351146caa1d0a15ff60c9029ea8654f.tar.gz | |
(request_shutdown) Prevent infinite loop on shutdown if there is an error
in shutdown function.
(php_array_walk) Print a warning if the walk function doesn't exist.
Split shutdown function call into a separate function that's called with
zend_hash_apply() instead of as destructor to keep hash consistent.
This fixes bug #3419.
Diffstat (limited to 'ext/standard/basic_functions.c')
| -rw-r--r-- | ext/standard/basic_functions.c | 19 |
1 files changed, 14 insertions, 5 deletions
diff --git a/ext/standard/basic_functions.c b/ext/standard/basic_functions.c index 3e70b22f5d..f5c571a21a 100644 --- a/ext/standard/basic_functions.c +++ b/ext/standard/basic_functions.c @@ -1045,25 +1045,34 @@ PHP_FUNCTION(call_user_method) void user_shutdown_function_dtor(php_shutdown_function_entry *shutdown_function_entry) { - pval retval; int i; - CLS_FETCH(); - if (call_user_function(CG(function_table), NULL, shutdown_function_entry->arguments[0], &retval, shutdown_function_entry->arg_count-1, shutdown_function_entry->arguments+1)==SUCCESS) { - pval_destructor(&retval); - } for (i=0; i<shutdown_function_entry->arg_count; i++) { zval_ptr_dtor(&shutdown_function_entry->arguments[i]); } efree(shutdown_function_entry->arguments); } +int user_shutdown_function_call(php_shutdown_function_entry *shutdown_function_entry) +{ + zval retval; + CLS_FETCH(); + + if (call_user_function(CG(function_table), NULL, shutdown_function_entry->arguments[0], &retval, shutdown_function_entry->arg_count-1, shutdown_function_entry->arguments+1)==SUCCESS) { + zval_dtor(&retval); + } else + php_error(E_WARNING,"Unable to call %s() - function does not exist", + shutdown_function_entry->arguments[0]->value.str.val); + return 0; +} void php_call_shutdown_functions(void) { BLS_FETCH(); if (BG(user_shutdown_function_names)) { + zend_hash_apply(BG(user_shutdown_function_names), + (apply_func_t)user_shutdown_function_call); zend_hash_destroy(BG(user_shutdown_function_names)); efree(BG(user_shutdown_function_names)); } |
