Browse Source

Fixed bug #62763 (register_shutdown_function and extending class)

pull/160/merge
Xinchen Hui 14 years ago
parent
commit
4970926e45
  1. 2
      NEWS
  2. 23
      Zend/tests/bug62763.phpt
  3. 7
      ext/standard/basic_functions.c

2
NEWS

@ -3,6 +3,8 @@ PHP NEWS
?? ??? 2012, PHP 5.3.16
- Core:
. Fixed bug #62763 (register_shutdown_function and extending class).
(Laruence)
. Fixed bug #62744 (dangling pointers made by zend_disable_class). (Laruence)
. Fixed bug #62716 (munmap() is called with the incorrect length).
(slangley@google.com)

23
Zend/tests/bug62763.phpt

@ -0,0 +1,23 @@
--TEST--
Bug #62763 (register_shutdown_function and extending class)
--FILE--
<?php
class test1 {
public function __construct() {
register_shutdown_function(array($this, 'shutdown'));
}
public function shutdown() {
exit(__METHOD__);
}
}
class test2 extends test1 {
public function __destruct() {
exit (__METHOD__);
}
}
new test1;
new test2;
?>
--EXPECT--
test1::shutdowntest2::__destruct

7
ext/standard/basic_functions.c

@ -5108,8 +5108,11 @@ void php_free_shutdown_functions(TSRMLS_D) /* {{{ */
zend_hash_destroy(BG(user_shutdown_function_names));
FREE_HASHTABLE(BG(user_shutdown_function_names));
BG(user_shutdown_function_names) = NULL;
}
zend_end_try();
} zend_catch {
/* maybe shutdown method call exit, we just ignore it */
FREE_HASHTABLE(BG(user_shutdown_function_names));
BG(user_shutdown_function_names) = NULL;
} zend_end_try();
}
/* }}} */

Loading…
Cancel
Save