summaryrefslogtreecommitdiff
path: root/Zend/zend_API.c
diff options
context:
space:
mode:
authorMarcus Boerger <helly@php.net>2008-08-08 17:47:31 +0000
committerMarcus Boerger <helly@php.net>2008-08-08 17:47:31 +0000
commit3f7a4b7e90eee47e7b6873f800e93854b0338dd4 (patch)
treea36ccc107e52711aa644eb9197fc3c7beb346deb /Zend/zend_API.c
parent6fb114f1d5a6013ef7cde20e296a228ead10aabd (diff)
downloadphp-git-3f7a4b7e90eee47e7b6873f800e93854b0338dd4.tar.gz
- MFH error handling, now with save, replace, restore
Diffstat (limited to 'Zend/zend_API.c')
-rw-r--r--Zend/zend_API.c31
1 files changed, 31 insertions, 0 deletions
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