php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Return to Bug #62985
Patch bug62985.patch revision 2012-08-31 17:29 UTC by laruence@php.net
revision 2012-08-31 17:25 UTC by laruence@php.net

Patch bug62985.patch for *Configuration Issues Bug #62985

Patch version 2012-08-31 17:29 UTC

Return to Bug #62985 | Download this patch
This patch renders other patches obsolete

Obsolete patches:

Patch Revisions:

Developer: laruence@php.net

diff --git a/Zend/zend_execute_API.c b/Zend/zend_execute_API.c
index 47a37d8..34bde26 100644
--- a/Zend/zend_execute_API.c
+++ b/Zend/zend_execute_API.c
@@ -1239,7 +1239,29 @@ ZEND_API int zend_eval_stringl_ex(char *str, int str_len, zval *retval_ptr, char
 
 	result = zend_eval_stringl(str, str_len, retval_ptr, string_name TSRMLS_CC);
 	if (handle_exceptions && EG(exception)) {
-		zend_exception_error(EG(exception), E_ERROR TSRMLS_CC);
+		if (EG(user_exception_handler)) {
+			zval *orig_user_exception_handler;
+			zval **params[1], *retval2, *old_exception;
+			old_exception = EG(exception);
+			EG(exception) = NULL;
+			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);
+				}
+				if (EG(exception)) {
+					zval_ptr_dtor(&EG(exception));
+					EG(exception) = NULL;
+				}
+				zval_ptr_dtor(&old_exception);
+			} else {
+				EG(exception) = old_exception;
+				zend_exception_error(EG(exception), E_ERROR TSRMLS_CC);
+			}
+		} else {
+			zend_exception_error(EG(exception), E_ERROR TSRMLS_CC);
+		}
 		result = FAILURE;
 	}
 	return result;
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sun Dec 22 01:01:30 2024 UTC