2003-06-02 02:35:29 +08:00
|
|
|
--TEST--
|
2003-07-25 01:07:40 +08:00
|
|
|
Bug #20240 (order of destructor calls)
|
2003-06-02 02:35:29 +08:00
|
|
|
--FILE--
|
|
|
|
<?php
|
|
|
|
|
|
|
|
class test
|
|
|
|
{
|
2003-11-30 21:18:56 +08:00
|
|
|
public $member;
|
2003-06-02 02:35:29 +08:00
|
|
|
|
2015-03-31 22:10:22 +08:00
|
|
|
function __construct() {
|
2003-06-02 02:35:29 +08:00
|
|
|
$this->member = 1;
|
|
|
|
register_shutdown_function(array($this, 'destructor'));
|
|
|
|
}
|
|
|
|
|
|
|
|
function destructor() {
|
2003-07-02 07:06:40 +08:00
|
|
|
print __METHOD__ . "\n";
|
|
|
|
}
|
|
|
|
|
|
|
|
function __destruct() {
|
|
|
|
print __METHOD__ . "\n";
|
2003-06-02 02:35:29 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
function add() {
|
|
|
|
$this->member += 1;
|
|
|
|
print $this->member."\n";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
$t = new test();
|
|
|
|
|
|
|
|
$t->add();
|
|
|
|
$t->add();
|
|
|
|
|
|
|
|
echo "Done\n";
|
|
|
|
?>
|
|
|
|
--EXPECT--
|
|
|
|
2
|
|
|
|
3
|
|
|
|
Done
|
2004-09-24 04:08:07 +08:00
|
|
|
test::destructor
|
2005-09-16 03:49:58 +08:00
|
|
|
test::__destruct
|