Skip to content

Commit 2d21149

Browse files
committed
Revert "Merge from PHP-5.4"
This reverts commit 9a87fe1.
1 parent fcae164 commit 2d21149

File tree

1 file changed

+18
-19
lines changed

1 file changed

+18
-19
lines changed

Zend/zend_builtin_functions.c

Lines changed: 18 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1488,42 +1488,41 @@ ZEND_FUNCTION(set_exception_handler)
14881488
{
14891489
zval *exception_handler;
14901490
char *exception_handler_name = NULL;
1491+
zend_bool had_orig_exception_handler=0;
14911492

14921493
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "z", &exception_handler) == FAILURE) {
14931494
return;
14941495
}
14951496

14961497
if (Z_TYPE_P(exception_handler) != IS_NULL) { /* NULL == unset */
1497-
zend_bool had_orig_exception_handler = 0;
1498-
14991498
if (!zend_is_callable(exception_handler, 0, &exception_handler_name TSRMLS_CC)) {
15001499
zend_error(E_WARNING, "%s() expects the argument (%s) to be a valid callback",
1501-
get_active_function_name(TSRMLS_C), exception_handler_name?exception_handler_name:"unknown");
1500+
get_active_function_name(TSRMLS_C), exception_handler_name?exception_handler_name:"unknown");
15021501
efree(exception_handler_name);
15031502
return;
15041503
}
15051504
efree(exception_handler_name);
1505+
}
15061506

1507-
if (EG(user_exception_handler)) {
1508-
had_orig_exception_handler = 1;
1509-
*return_value = *EG(user_exception_handler);
1510-
zval_copy_ctor(return_value);
1511-
zend_ptr_stack_push(&EG(user_exception_handlers), EG(user_exception_handler));
1512-
}
1513-
1514-
ALLOC_ZVAL(EG(user_exception_handler));
1515-
MAKE_COPY_ZVAL(&exception_handler, EG(user_exception_handler));
1507+
if (EG(user_exception_handler)) {
1508+
had_orig_exception_handler = 1;
1509+
*return_value = *EG(user_exception_handler);
1510+
zval_copy_ctor(return_value);
1511+
zend_ptr_stack_push(&EG(user_exception_handlers), EG(user_exception_handler));
1512+
}
1513+
ALLOC_ZVAL(EG(user_exception_handler));
15161514

1517-
if (!had_orig_exception_handler) {
1518-
RETURN_NULL();
1519-
}
1520-
} else {
1521-
if (EG(user_exception_handler)) {
1522-
zend_ptr_stack_push(&EG(user_exception_handlers), EG(user_exception_handler));
1523-
}
1515+
if (Z_TYPE_P(exception_handler) == IS_NULL) { /* unset user-defined handler */
1516+
FREE_ZVAL(EG(user_exception_handler));
15241517
EG(user_exception_handler) = NULL;
15251518
RETURN_TRUE;
15261519
}
1520+
1521+
MAKE_COPY_ZVAL(&exception_handler, EG(user_exception_handler))
1522+
1523+
if (!had_orig_exception_handler) {
1524+
RETURN_NULL();
1525+
}
15271526
}
15281527
/* }}} */
15291528

0 commit comments

Comments
 (0)