com php-src: Revert "Merge from PHP-5.4": Zend/zend_builtin _functions.c
| From: | Xinchen Hui | Date: | Sat, 24 Mar 2012 11:25:21 +0000 |
| Subject: | com php-src: Revert "Merge from PHP-5.4": Zend/zend_builtin _functions.c | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-68175@lists.php.net to get a copy of this message | ||
Commit: 2d21149743c8ef52e5fdf62da18a1a903c09670a
Author: Xinchen Hui <laruence@gmail.com> Sat, 24 Mar 2012 19:25:21 +0800
Parents: fcae164ea63979d7814d7aa114fe8351033e7400
Branches: PHP-5.3 PHP-5.4 master
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=2d21149743c8ef52e5fdf62da18a1a903c09670a
Log:
Revert "Merge from PHP-5.4"
This reverts commit 9a87fe1c529eabc7aeec4559d916dda5fda3cdd2.
Changed paths:
M Zend/zend_builtin_functions.c
Diff:
2d21149743c8ef52e5fdf62da18a1a903c09670a
diff --git a/Zend/zend_builtin_functions.c b/Zend/zend_builtin_functions.c
index c4a10fd..ce54f4e 100644
--- a/Zend/zend_builtin_functions.c
+++ b/Zend/zend_builtin_functions.c
@@ -1488,42 +1488,41 @@ ZEND_FUNCTION(set_exception_handler)
{
zval *exception_handler;
char *exception_handler_name = NULL;
+ zend_bool had_orig_exception_handler=0;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "z", &exception_handler) ==
FAILURE) {
return;
}
if (Z_TYPE_P(exception_handler) != IS_NULL) { /* NULL == unset */
- zend_bool had_orig_exception_handler = 0;
-
if (!zend_is_callable(exception_handler, 0, &exception_handler_name TSRMLS_CC)) {
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");
+ get_active_function_name(TSRMLS_C),
exception_handler_name?exception_handler_name:"unknown");
efree(exception_handler_name);
return;
}
efree(exception_handler_name);
+ }
- if (EG(user_exception_handler)) {
- had_orig_exception_handler = 1;
- *return_value = *EG(user_exception_handler);
- zval_copy_ctor(return_value);
- zend_ptr_stack_push(&EG(user_exception_handlers), EG(user_exception_handler));
- }
-
- ALLOC_ZVAL(EG(user_exception_handler));
- MAKE_COPY_ZVAL(&exception_handler, EG(user_exception_handler));
+ if (EG(user_exception_handler)) {
+ had_orig_exception_handler = 1;
+ *return_value = *EG(user_exception_handler);
+ zval_copy_ctor(return_value);
+ zend_ptr_stack_push(&EG(user_exception_handlers), EG(user_exception_handler));
+ }
+ ALLOC_ZVAL(EG(user_exception_handler));
- if (!had_orig_exception_handler) {
- RETURN_NULL();
- }
- } else {
- if (EG(user_exception_handler)) {
- zend_ptr_stack_push(&EG(user_exception_handlers), EG(user_exception_handler));
- }
+ if (Z_TYPE_P(exception_handler) == IS_NULL) { /* unset user-defined handler */
+ FREE_ZVAL(EG(user_exception_handler));
EG(user_exception_handler) = NULL;
RETURN_TRUE;
}
+
+ MAKE_COPY_ZVAL(&exception_handler, EG(user_exception_handler))
+
+ if (!had_orig_exception_handler) {
+ RETURN_NULL();
+ }
}
/* }}} */