summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndi Gutmans <andi@php.net>2004-04-13 15:19:21 +0000
committerAndi Gutmans <andi@php.net>2004-04-13 15:19:21 +0000
commit979da661186cd00d3fc2a86d9a550c726b210356 (patch)
tree06c2f1de322a64b4be7f5191fed74c589be04dc8
parent254c8d6ce92d080b914337ab38b5cdfd99fe5dcc (diff)
downloadphp-git-979da661186cd00d3fc2a86d9a550c726b210356.tar.gz
- Add hook for exception handler (Derick)
-rw-r--r--Zend/zend.c1
-rw-r--r--Zend/zend_exceptions.c5
-rw-r--r--Zend/zend_exceptions.h2
3 files changed, 8 insertions, 0 deletions
diff --git a/Zend/zend.c b/Zend/zend.c
index 4e1c83d099..2ca28c4773 100644
--- a/Zend/zend.c
+++ b/Zend/zend.c
@@ -581,6 +581,7 @@ int zend_startup(zend_utility_functions *utility_functions, char **extensions, i
zend_compile_file = compile_file;
zend_execute = execute;
zend_execute_internal = NULL;
+ zend_throw_exception_hook = NULL;
zend_init_opcodes_handlers();
diff --git a/Zend/zend_exceptions.c b/Zend/zend_exceptions.c
index 6254810a5a..c13e6dac8a 100644
--- a/Zend/zend_exceptions.c
+++ b/Zend/zend_exceptions.c
@@ -30,6 +30,7 @@
zend_class_entry *default_exception_ce;
static zend_object_handlers default_exception_handlers;
ZEND_API void zend_throw_exception(zend_class_entry *exception_ce, char *message, long code TSRMLS_DC);
+ZEND_API void (*zend_throw_exception_hook)(zval *ex TSRMLS_DC);
void zend_throw_exception_internal(zval *exception TSRMLS_DC)
@@ -45,6 +46,10 @@ void zend_throw_exception_internal(zval *exception TSRMLS_DC)
zend_error(E_ERROR, "Exception thrown without a stack frame");
}
+ if (zend_throw_exception_hook) {
+ zend_throw_exception_hook(exception TSRMLS_CC);
+ }
+
if ((EG(current_execute_data)->opline+1)->opcode == ZEND_HANDLE_EXCEPTION) {
/* no need to rethrow the exception */
return;
diff --git a/Zend/zend_exceptions.h b/Zend/zend_exceptions.h
index b5653c8488..059a60479c 100644
--- a/Zend/zend_exceptions.h
+++ b/Zend/zend_exceptions.h
@@ -40,6 +40,8 @@ ZEND_API void zend_throw_exception_ex(zend_class_entry *exception_ce, long code
ZEND_API void zend_throw_exception_object(zval *exception TSRMLS_DC);
ZEND_API void zend_clear_exception(TSRMLS_D);
+ZEND_API void (*zend_throw_exception_hook)(zval *ex TSRMLS_DC);
+
/* show an exception using zend_error(E_ERROR,...) */
ZEND_API void zend_exception_error(zval *exception TSRMLS_DC);