diff options
author | Xinchen Hui <laruence@php.net> | 2012-08-12 20:58:09 +0800 |
---|---|---|
committer | Xinchen Hui <laruence@php.net> | 2012-08-12 20:58:09 +0800 |
commit | 4970926e4543c15e16b0c047d85dddfb4c09b581 (patch) | |
tree | 80600b486603972f36ac5dce7af422c499ea6c9d | |
parent | e1180b4f1aea83ee5dc7f62832a10056e0f62f18 (diff) | |
download | php-git-4970926e4543c15e16b0c047d85dddfb4c09b581.tar.gz |
Fixed bug #62763 (register_shutdown_function and extending class)
-rw-r--r-- | NEWS | 2 | ||||
-rw-r--r-- | Zend/tests/bug62763.phpt | 23 | ||||
-rw-r--r-- | ext/standard/basic_functions.c | 7 |
3 files changed, 30 insertions, 2 deletions
@@ -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) diff --git a/Zend/tests/bug62763.phpt b/Zend/tests/bug62763.phpt new file mode 100644 index 0000000000..50c27bdf35 --- /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 99831a1f42..4858b6e375 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(); } /* }}} */ |