summaryrefslogtreecommitdiff
path: root/Zend/zend_execute_API.c
diff options
context:
space:
mode:
authorDmitry Stogov <dmitry@zend.com>2016-12-12 10:55:32 +0300
committerDmitry Stogov <dmitry@zend.com>2016-12-12 10:55:32 +0300
commitfac95658b3201fdc7924cd3afa44a5f7afc194aa (patch)
tree2558b17ab5c03e90f34ae982c5a4a36a69562683 /Zend/zend_execute_API.c
parent32201fe5ad97251f9a33a11b2fdbd7f24382fc11 (diff)
downloadphp-git-fac95658b3201fdc7924cd3afa44a5f7afc194aa.tar.gz
Improved VM stack unwinding on exception.
Now zend_throw_exception_hook() is going to be called only when exception is actually thrown and not going to be recalled for each unwinded finction.
Diffstat (limited to 'Zend/zend_execute_API.c')
-rw-r--r--Zend/zend_execute_API.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/Zend/zend_execute_API.c b/Zend/zend_execute_API.c
index c01a807e55..a4a1d3f4da 100644
--- a/Zend/zend_execute_API.c
+++ b/Zend/zend_execute_API.c
@@ -899,9 +899,15 @@ int zend_call_function(zend_fcall_info *fci, zend_fcall_info_cache *fci_cache) /
EG(current_execute_data) = dummy_execute_data.prev_execute_data;
}
- if (EG(exception)) {
- zend_throw_exception_internal(NULL);
+ if (UNEXPECTED(EG(exception))) {
+ if (UNEXPECTED(!EG(current_execute_data))) {
+ zend_throw_exception_internal(NULL);
+ } else if (EG(current_execute_data)->func &&
+ ZEND_USER_CODE(EG(current_execute_data)->func->common.type)) {
+ zend_rethrow_exception(EG(current_execute_data));
+ }
}
+
return SUCCESS;
}
/* }}} */