]> granicus.if.org Git - php/commitdiff
- Fix the following script (it crashed):
authorAndi Gutmans <andi@php.net>
Sun, 23 May 2004 20:27:32 +0000 (20:27 +0000)
committerAndi Gutmans <andi@php.net>
Sun, 23 May 2004 20:27:32 +0000 (20:27 +0000)
<?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();
?>

Zend/zend_builtin_functions.c

index 69015a6b1832eba6c2eda4d6ead201d2abd18113..3e9c72f0c049968426edca0dc164a76743682820 100644 (file)
@@ -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 {