Commit: 4970926e4543c15e16b0c047d85dddfb4c09b581 Author: Xinchen Hui <[email protected]> Sun, 12 Aug 2012 20:58:09 +0800 Parents: e1180b4f1aea83ee5dc7f62832a10056e0f62f18 Branches: PHP-5.3
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=4970926e4543c15e16b0c047d85dddfb4c09b581 Log: Fixed bug #62763 (register_shutdown_function and extending class) Bugs: https://bugs.php.net/62763 Changed paths: M NEWS A Zend/tests/bug62763.phpt M ext/standard/basic_functions.c Diff: diff --git a/NEWS b/NEWS index 70cbe8e..985e274 100644 --- a/NEWS +++ b/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). ([email protected]) diff --git a/Zend/tests/bug62763.phpt b/Zend/tests/bug62763.phpt new file mode 100644 index 0000000..50c27bd --- /dev/null +++ b/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 diff --git a/ext/standard/basic_functions.c b/ext/standard/basic_functions.c index 99831a1..4858b6e 100644 --- a/ext/standard/basic_functions.c +++ b/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(); } /* }}} */ -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
