summaryrefslogtreecommitdiff
path: root/Zend/zend_builtin_functions.c
diff options
context:
space:
mode:
authorZeev Suraski <zeev@php.net>2000-04-19 15:08:06 +0000
committerZeev Suraski <zeev@php.net>2000-04-19 15:08:06 +0000
commit67f6974373ce9871b6a7e39d12e80d724d1935d0 (patch)
tree995963e554d0a9d8ce7373b73f84a720bce41569 /Zend/zend_builtin_functions.c
parentfae56aee27e3ccb8b40cc914b382608be1ecda16 (diff)
downloadphp-git-67f6974373ce9871b6a7e39d12e80d724d1935d0.tar.gz
Initial support for trapping errors (not complete and disabled; will be enabled only
post-PHP 4.0.0)
Diffstat (limited to 'Zend/zend_builtin_functions.c')
-rw-r--r--Zend/zend_builtin_functions.c24
1 files changed, 24 insertions, 0 deletions
diff --git a/Zend/zend_builtin_functions.c b/Zend/zend_builtin_functions.c
index bed8b82b3a..e313123943 100644
--- a/Zend/zend_builtin_functions.c
+++ b/Zend/zend_builtin_functions.c
@@ -53,6 +53,7 @@ static ZEND_FUNCTION(get_class_vars);
static ZEND_FUNCTION(get_object_vars);
static ZEND_FUNCTION(get_class_methods);
static ZEND_FUNCTION(user_error);
+static ZEND_FUNCTION(set_user_error_handler);
unsigned char first_arg_force_ref[] = { 1, BYREF_FORCE };
unsigned char first_arg_allow_ref[] = { 1, BYREF_ALLOW };
@@ -88,6 +89,7 @@ static zend_function_entry builtin_functions[] = {
ZEND_FE(get_object_vars, NULL)
ZEND_FE(get_class_methods, NULL)
ZEND_FE(user_error, NULL)
+ ZEND_FE(set_user_error_handler, NULL)
{ NULL, NULL, NULL }
};
@@ -732,3 +734,25 @@ ZEND_FUNCTION(user_error)
RETURN_TRUE;
}
/* }}} */
+
+
+ZEND_FUNCTION(set_user_error_handler)
+{
+ zval **error_handler;
+
+ if (ZEND_NUM_ARGS()!=1 || zend_get_parameters_ex(1, &error_handler)==FAILURE) {
+ ZEND_WRONG_PARAM_COUNT();
+ }
+
+ convert_to_string_ex(error_handler);
+ if (EG(user_error_handler)) {
+ zval_dtor(EG(user_error_handler));
+ } else {
+ ALLOC_ZVAL(EG(user_error_handler));
+ }
+
+ *EG(user_error_handler) = **error_handler;
+ zval_copy_ctor(EG(user_error_handler));
+
+ RETURN_TRUE;
+}