summaryrefslogtreecommitdiff
path: root/Zend/zend.c
diff options
context:
space:
mode:
authorMarcus Boerger <helly@php.net>2008-08-14 10:24:52 +0000
committerMarcus Boerger <helly@php.net>2008-08-14 10:24:52 +0000
commit32f9d0e180af2d809bf70e40850fc75e6d663945 (patch)
treed5ad09ae92ff108bf761c268b543dc2a0235e4b2 /Zend/zend.c
parent261b4d0965bf0011c677c2ed431de77719a9cb46 (diff)
downloadphp-git-32f9d0e180af2d809bf70e40850fc75e6d663945.tar.gz
- MFH Improve exception linking
Diffstat (limited to 'Zend/zend.c')
-rw-r--r--Zend/zend.c21
1 files changed, 9 insertions, 12 deletions
diff --git a/Zend/zend.c b/Zend/zend.c
index c2cd2450e3..ee1090dcf0 100644
--- a/Zend/zend.c
+++ b/Zend/zend.c
@@ -1197,31 +1197,28 @@ ZEND_API int zend_execute_scripts(int type TSRMLS_DC, zval **retval, int file_co
if (EG(active_op_array)) {
EG(return_value_ptr_ptr) = retval ? retval : NULL;
zend_execute(EG(active_op_array) TSRMLS_CC);
+ zend_exception_restore(TSRMLS_C);
if (EG(exception)) {
if (EG(user_exception_handler)) {
zval *orig_user_exception_handler;
- zval ***params, *retval2, *old_exception;
- params = (zval ***)emalloc(sizeof(zval **));
+ zval **params[1], *retval2, *old_exception;
old_exception = EG(exception);
- EG(exception) = NULL;
+ zend_exception_save(TSRMLS_C);
params[0] = &old_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) {
if (retval2 != NULL) {
zval_ptr_dtor(&retval2);
}
- } else {
- if (!EG(exception)) {
- EG(exception) = old_exception;
+ zend_exception_restore(TSRMLS_C);
+ if (EG(exception)) {
+ zval_ptr_dtor(&EG(exception));
+ EG(exception) = NULL;
}
+ } else {
+ zend_exception_restore(TSRMLS_C);
zend_exception_error(EG(exception) TSRMLS_CC);
}
- efree(params);
- zval_ptr_dtor(&old_exception);
- if (EG(exception)) {
- zval_ptr_dtor(&EG(exception));
- EG(exception) = NULL;
- }
} else {
zend_exception_error(EG(exception) TSRMLS_CC);
}