Skip to content

Commit 253760b

Browse files
committed
Merge branch 'PHP-5.4'
2 parents 9787e7a + be818e7 commit 253760b

File tree

2 files changed

+28
-2
lines changed

2 files changed

+28
-2
lines changed

Zend/tests/bug62763.phpt

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
--TEST--
2+
Bug #62763 (register_shutdown_function and extending class)
3+
--FILE--
4+
<?php
5+
class test1 {
6+
public function __construct() {
7+
register_shutdown_function(array($this, 'shutdown'));
8+
}
9+
public function shutdown() {
10+
exit(__METHOD__);
11+
}
12+
}
13+
14+
class test2 extends test1 {
15+
public function __destruct() {
16+
exit (__METHOD__);
17+
}
18+
}
19+
new test1;
20+
new test2;
21+
?>
22+
--EXPECT--
23+
test1::shutdowntest2::__destruct

ext/standard/basic_functions.c

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5067,8 +5067,11 @@ void php_free_shutdown_functions(TSRMLS_D) /* {{{ */
50675067
zend_hash_destroy(BG(user_shutdown_function_names));
50685068
FREE_HASHTABLE(BG(user_shutdown_function_names));
50695069
BG(user_shutdown_function_names) = NULL;
5070-
}
5071-
zend_end_try();
5070+
} zend_catch {
5071+
/* maybe shutdown method call exit, we just ignore it */
5072+
FREE_HASHTABLE(BG(user_shutdown_function_names));
5073+
BG(user_shutdown_function_names) = NULL;
5074+
} zend_end_try();
50725075
}
50735076
/* }}} */
50745077

0 commit comments

Comments
 (0)