diff options
| author | Remi Collet <remi@php.net> | 2017-06-26 17:22:01 +0200 |
|---|---|---|
| committer | Remi Collet <remi@php.net> | 2017-06-26 17:22:01 +0200 |
| commit | 85c32322acfc07628140bf631e7c52b12e6050b4 (patch) | |
| tree | ae79035283e68957177407123d7d342278e021d9 /ext/standard/basic_functions.c | |
| parent | 4ed8ff509001b35e0cb971a1d6a294345c5d7673 (diff) | |
| parent | caaeb4849aa56cbbdc66ea015c11a58bd47a43ff (diff) | |
| download | php-git-85c32322acfc07628140bf631e7c52b12e6050b4.tar.gz | |
Merge branch 'master' of git.php.net:php-src
* 'master' of git.php.net:php-src: (24 commits)
Removed EG(valid_symbol_table). Used EG(active) instead.
Release temporary string reference
Remove superfluous semicolons
Fix tests on Windows
Produce a better exception message when IntlDateFormatter constructor fails.
Fix format arguments
Remove unused variable op2. It is redeclared later.
Fix typo
Implement object type annotation
Fixed bug #73173
Expose inflate_get_status() and inflate_get_read_len() functions
Add more constants, improve comments, and add tests
Fixed bug #73900
Add OPENSSL_DONT_ZERO_PAD_KEY constant to prevent key padding
Drop soap_hash_str_find_deref()
Only compute callback name in error cases
Extract zend_get_callable_name() API
Move va_copy compatibility code into zend_portability.h
Remove unnecessary string copy
Fix FE_FETCH_* exception check
...
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); - } } /* }}} */ |
