summaryrefslogtreecommitdiff
path: root/Zend/zend_builtin_functions.c
diff options
context:
space:
mode:
authorAndi Gutmans <andi@php.net>2004-05-23 20:27:32 +0000
committerAndi Gutmans <andi@php.net>2004-05-23 20:27:32 +0000
commitef9878647df7bac9deb79bc2d691557a724dce21 (patch)
tree92cb0911c6bfab93dbbc772a38f505d365204b6d /Zend/zend_builtin_functions.c
parente4c5e85697882b41aec6f1a29f26c5110da58275 (diff)
downloadphp-git-ef9878647df7bac9deb79bc2d691557a724dce21.tar.gz
- Fix the following script (it crashed):
<?php class ErrorHandler { function __construct() { set_error_handler(array(&$this, 'handle')); } function __destruct() { restore_error_handler(); } function handle($code, $msg, $file, $line, $locals) { } } new ErrorHandler(); ?>
Diffstat (limited to 'Zend/zend_builtin_functions.c')
-rw-r--r--Zend/zend_builtin_functions.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/Zend/zend_builtin_functions.c b/Zend/zend_builtin_functions.c
index 69015a6b18..3e9c72f0c0 100644
--- a/Zend/zend_builtin_functions.c
+++ b/Zend/zend_builtin_functions.c
@@ -1005,8 +1005,12 @@ ZEND_FUNCTION(set_error_handler)
ZEND_FUNCTION(restore_error_handler)
{
if (EG(user_error_handler)) {
- zval_ptr_dtor(&EG(user_error_handler));
+ zval *zeh = EG(user_error_handler);
+
+ EG(user_error_handler) = NULL;
+ zval_ptr_dtor(&zeh);
}
+
if (zend_ptr_stack_num_elements(&EG(user_error_handlers))==0) {
EG(user_error_handler) = NULL;
} else {