#34528 [Opn->Bgs]: strange destructor behavior
| From: | sniper@php.net | Date: | Fri, 16 Sep 2005 14:46:49 +0000 |
| Subject: | #34528 [Opn->Bgs]: strange destructor behavior | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-85161@lists.php.net to get a copy of this message | ||
ID: 34528
Updated by: sniper@php.net
Reported By: silencer at reignofwar dot de
-Status: Open
+Status: Bogus
Bug Type: Class/Object related
Operating System: Ubuntu 5.10 (Linux 2.6.12)
PHP Version: 5.0.5
New Comment:
__construct() call are always run before __destruct(). Latter being
done during request shutdown. No bug here.
Previous Comments:
------------------------------------------------------------------------
[2005-09-16 16:39:56] silencer at reignofwar dot de
Description:
------------
Only look at the code and the output of it. I think, new
objects in variables, which are already existent and
contain an old object, should be call the destructor of
the old object... im sorry for my english...
Reproduce code:
---------------
<?php
class test {
static $i = 0;
public function __construct() {
self::$i ++;
echo "alive: " . self::$i . "<br />";
}
public function __destruct() {
echo "dead" . self::$i . "<br />";
}
}
$obj = new test;
$obj = new test;
?>
Expected result:
----------------
alive: 1
dead1
alive: 2
dead2
Actual result:
--------------
alive: 1
alive: 2
dead2
dead2
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=34528&edit=1