diff options
Diffstat (limited to 'ext/standard/basic_functions.c')
-rw-r--r-- | ext/standard/basic_functions.c | 31 |
1 files changed, 10 insertions, 21 deletions
diff --git a/ext/standard/basic_functions.c b/ext/standard/basic_functions.c index 8f73153bba..383e988090 100644 --- a/ext/standard/basic_functions.c +++ b/ext/standard/basic_functions.c @@ -4976,19 +4976,13 @@ static int user_shutdown_function_call(zval *zv) /* {{{ */ { php_shutdown_function_entry *shutdown_function_entry = Z_PTR_P(zv); zval retval; - zend_string *function_name; - if (!zend_is_callable(&shutdown_function_entry->arguments[0], 0, &function_name)) { - if (function_name) { - php_error(E_WARNING, "(Registered shutdown functions) Unable to call %s() - function does not exist", ZSTR_VAL(function_name)); - zend_string_release(function_name); - } else { - php_error(E_WARNING, "(Registered shutdown functions) Unable to call - function does not exist"); - } - return 0; - } - if (function_name) { + if (!zend_is_callable(&shutdown_function_entry->arguments[0], 0, NULL)) { + zend_string *function_name + = zend_get_callable_name(&shutdown_function_entry->arguments[0]); + php_error(E_WARNING, "(Registered shutdown functions) Unable to call %s() - function does not exist", ZSTR_VAL(function_name)); zend_string_release(function_name); + return 0; } if (call_user_function(EG(function_table), NULL, @@ -5102,7 +5096,6 @@ PHPAPI void php_free_shutdown_functions(void) /* {{{ */ PHP_FUNCTION(register_shutdown_function) { php_shutdown_function_entry shutdown_function_entry; - zend_string *callback_name = NULL; int i; shutdown_function_entry.arg_count = ZEND_NUM_ARGS(); @@ -5119,13 +5112,12 @@ PHP_FUNCTION(register_shutdown_function) } /* Prevent entering of anything but valid callback (syntax check only!) */ - if (!zend_is_callable(&shutdown_function_entry.arguments[0], 0, &callback_name)) { - if (callback_name) { - php_error_docref(NULL, E_WARNING, "Invalid shutdown callback '%s' passed", ZSTR_VAL(callback_name)); - } else { - php_error_docref(NULL, E_WARNING, "Invalid shutdown callback passed"); - } + if (!zend_is_callable(&shutdown_function_entry.arguments[0], 0, NULL)) { + zend_string *callback_name + = zend_get_callable_name(&shutdown_function_entry.arguments[0]); + php_error_docref(NULL, E_WARNING, "Invalid shutdown callback '%s' passed", ZSTR_VAL(callback_name)); efree(shutdown_function_entry.arguments); + zend_string_release(callback_name); RETVAL_FALSE; } else { if (!BG(user_shutdown_function_names)) { @@ -5138,9 +5130,6 @@ PHP_FUNCTION(register_shutdown_function) } zend_hash_next_index_insert_mem(BG(user_shutdown_function_names), &shutdown_function_entry, sizeof(php_shutdown_function_entry)); } - if (callback_name) { - zend_string_release(callback_name); - } } /* }}} */ |