summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorXinchen Hui <laruence@php.net>2012-08-12 20:58:45 +0800
committerXinchen Hui <laruence@php.net>2012-08-12 20:58:45 +0800
commitdda0565b53803a3fbed36b94e4c03a02d7b7d2a0 (patch)
tree5827e586246c91c604aa56923fbec19a2d7f5c7c
parent786670f53682c1e43f52c7642e6e47ed25f6708d (diff)
parent4970926e4543c15e16b0c047d85dddfb4c09b581 (diff)
downloadphp-git-dda0565b53803a3fbed36b94e4c03a02d7b7d2a0.tar.gz
Merge branch 'PHP-5.3' into PHP-5.4
-rw-r--r--Zend/tests/bug62763.phpt23
-rw-r--r--ext/standard/basic_functions.c7
2 files changed, 28 insertions, 2 deletions
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 e6de34e5fd..72f1dc3c76 100644
--- a/ext/standard/basic_functions.c
+++ b/ext/standard/basic_functions.c
@@ -5043,8 +5043,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();
}
/* }}} */