mirror of
https://github.com/php/php-src.git
synced 2024-11-23 18:04:36 +08:00
- Add hook for exception handler (Derick)
This commit is contained in:
parent
254c8d6ce9
commit
979da66118
@ -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();
|
||||
|
||||
|
@ -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;
|
||||
|
@ -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);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user