Browse Source

- 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();
?>
PHP-5.0
Andi Gutmans 23 years ago
parent
commit
ef9878647d
  1. 6
      Zend/zend_builtin_functions.c

6
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 {

Loading…
Cancel
Save