From 3f7a4b7e90eee47e7b6873f800e93854b0338dd4 Mon Sep 17 00:00:00 2001 From: Marcus Boerger Date: Fri, 8 Aug 2008 17:47:31 +0000 Subject: - MFH error handling, now with save, replace, restore --- Zend/zend_API.c | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) (limited to 'Zend/zend_API.c') diff --git a/Zend/zend_API.c b/Zend/zend_API.c index da7548f407..e15109bcff 100644 --- a/Zend/zend_API.c +++ b/Zend/zend_API.c @@ -3463,6 +3463,37 @@ ZEND_API zval *zend_read_static_property(zend_class_entry *scope, char *name, in } /* }}} */ +ZEND_API void zend_save_error_handling(zend_error_handling *current TSRMLS_DC) /* {{{ */ +{ + current->handling = EG(error_handling); + current->exception = EG(exception_class); +} +/* }}} */ + +ZEND_API void zend_replace_error_handling(zend_error_handling_t error_handling, zend_class_entry *exception_class, zend_error_handling *current TSRMLS_DC) /* {{{ */ +{ + if (current) { + zend_save_error_handling(current TSRMLS_CC); + } + EG(error_handling) = error_handling; + EG(exception_class) = error_handling == EH_THROW ? exception_class : NULL; + + if (error_handling == EH_NORMAL) { + EG(user_error_handler) = EG(user_error_handler_old); + } else { + EG(user_error_handler_old) = EG(user_error_handler); + EG(user_error_handler) = NULL; + } +} +/* }}} */ + +ZEND_API void zend_restore_error_handling(const zend_error_handling *saved TSRMLS_DC) /* {{{ */ +{ + EG(error_handling) = saved->handling; + EG(exception_class) = saved->handling == EH_THROW ? saved->exception : NULL; +} +/* }}} */ + /* * Local variables: * tab-width: 4 -- cgit v1.2.1