mirror of
https://github.com/php/php-src.git
synced 2024-11-25 19:05:31 +08:00
- Fix set_exception_handler
# unsettign with '' never worked so we use NULL now which is much better # because it matches the the return NULL in case no handler was defined # and can't lead to problems with wrong string operations.
This commit is contained in:
parent
04f75f2357
commit
0f9b3de234
@ -1109,13 +1109,15 @@ ZEND_FUNCTION(set_exception_handler)
|
||||
ZEND_WRONG_PARAM_COUNT();
|
||||
}
|
||||
|
||||
if (!zend_is_callable(*exception_handler, 0, &exception_handler_name)) {
|
||||
zend_error(E_WARNING, "%s() expects the argument (%s) to be a valid callback",
|
||||
get_active_function_name(TSRMLS_C), exception_handler_name?exception_handler_name:"unknown");
|
||||
if (Z_TYPE_PP(exception_handler) != IS_NULL) { /* NULL == unset */
|
||||
if (!zend_is_callable(*exception_handler, 0, &exception_handler_name)) {
|
||||
zend_error(E_WARNING, "%s() expects the argument (%s) to be a valid callback",
|
||||
get_active_function_name(TSRMLS_C), exception_handler_name?exception_handler_name:"unknown");
|
||||
efree(exception_handler_name);
|
||||
return;
|
||||
}
|
||||
efree(exception_handler_name);
|
||||
return;
|
||||
}
|
||||
efree(exception_handler_name);
|
||||
|
||||
if (EG(user_exception_handler)) {
|
||||
had_orig_exception_handler = 1;
|
||||
@ -1125,7 +1127,7 @@ ZEND_FUNCTION(set_exception_handler)
|
||||
}
|
||||
ALLOC_ZVAL(EG(user_exception_handler));
|
||||
|
||||
if (Z_STRLEN_PP(exception_handler)==0) { /* unset user-defined handler */
|
||||
if (Z_TYPE_PP(exception_handler) == IS_NULL) { /* unset user-defined handler */
|
||||
FREE_ZVAL(EG(user_exception_handler));
|
||||
EG(user_exception_handler) = NULL;
|
||||
RETURN_TRUE;
|
||||
|
Loading…
Reference in New Issue
Block a user