summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Zend/zend.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/Zend/zend.c b/Zend/zend.c
index fb5646a661..3901a46457 100644
--- a/Zend/zend.c
+++ b/Zend/zend.c
@@ -870,7 +870,13 @@ ZEND_API int zend_execute_scripts(int type TSRMLS_DC, zval **retval, int file_co
params[0] = &EG(exception);
orig_user_exception_handler = EG(user_exception_handler);
if (call_user_function_ex(CG(function_table), NULL, orig_user_exception_handler, &retval2, 1, params, 1, NULL TSRMLS_CC) == SUCCESS) {
- zval_ptr_dtor(&retval2);
+ if (retval2 != NULL) {
+ zval_ptr_dtor(&retval2);
+ }
+ } else {
+ zval_ptr_dtor(&EG(exception));
+ EG(exception) = NULL;
+ zend_error(E_ERROR, "Uncaught exception!");
}
efree(params);
zval_ptr_dtor(&EG(exception));
@@ -880,7 +886,7 @@ ZEND_API int zend_execute_scripts(int type TSRMLS_DC, zval **retval, int file_co
EG(exception) = NULL;
zend_error(E_ERROR, "Uncaught exception!");
}
- if (!retval) {
+ if (retval == NULL && *EG(return_value_ptr_ptr) != NULL) {
zval_ptr_dtor(EG(return_value_ptr_ptr));
local_retval = NULL;
}