]> granicus.if.org Git - php/commitdiff
- Add hook for exception handler (Derick)
authorAndi Gutmans <andi@php.net>
Tue, 13 Apr 2004 15:19:21 +0000 (15:19 +0000)
committerAndi Gutmans <andi@php.net>
Tue, 13 Apr 2004 15:19:21 +0000 (15:19 +0000)
Zend/zend.c
Zend/zend_exceptions.c
Zend/zend_exceptions.h

index 4e1c83d099a5276035f27bbd52f782091e8281b9..2ca28c4773ef0a819678ab8260063b3008e35b71 100644 (file)
@@ -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();
 
index 6254810a5ae6d93942eaafc4353deb679b6d3127..c13e6dac8a7454933db2f518ca1f64df271055bb 100644 (file)
@@ -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;
index b5653c8488b4effe672624f7c2d7e6d36663e488..059a60479c3eeecce599dbfdea5e558c9634d4e1 100644 (file)
@@ -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);