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
|
|
|
--SKIPIF--
|
|
|
|
<?php if (version_compare(zend_version(), '2.0.0-dev', '<')) die('skip ZendEngine 2 is needed'); ?>
|
|
|
|
--FILE--
|
|
|
|
<?php
|
|
|
|
|
|
|
|
class test
|
|
|
|
{
|
2003-11-30 21:18:56 +08:00
|
|
|
public $member;
|
2003-06-02 02:35:29 +08:00
|
|
|
|
|
|
|
function test() {
|
|
|
|
$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
|