From:             silencer at reignofwar dot de
Operating system: Ubuntu 5.10 (Linux 2.6.12)
PHP version:      5.0.5
PHP Bug Type:     Class/Object related
Bug description:  strange destructor behavior

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 bug report at http://bugs.php.net/?id=34528&edit=1
-- 
Try a CVS snapshot (php4):   http://bugs.php.net/fix.php?id=34528&r=trysnapshot4
Try a CVS snapshot (php5.0): 
http://bugs.php.net/fix.php?id=34528&r=trysnapshot50
Try a CVS snapshot (php5.1): 
http://bugs.php.net/fix.php?id=34528&r=trysnapshot51
Fixed in CVS:                http://bugs.php.net/fix.php?id=34528&r=fixedcvs
Fixed in release:            http://bugs.php.net/fix.php?id=34528&r=alreadyfixed
Need backtrace:              http://bugs.php.net/fix.php?id=34528&r=needtrace
Need Reproduce Script:       http://bugs.php.net/fix.php?id=34528&r=needscript
Try newer version:           http://bugs.php.net/fix.php?id=34528&r=oldversion
Not developer issue:         http://bugs.php.net/fix.php?id=34528&r=support
Expected behavior:           http://bugs.php.net/fix.php?id=34528&r=notwrong
Not enough info:             
http://bugs.php.net/fix.php?id=34528&r=notenoughinfo
Submitted twice:             
http://bugs.php.net/fix.php?id=34528&r=submittedtwice
register_globals:            http://bugs.php.net/fix.php?id=34528&r=globals
PHP 3 support discontinued:  http://bugs.php.net/fix.php?id=34528&r=php3
Daylight Savings:            http://bugs.php.net/fix.php?id=34528&r=dst
IIS Stability:               http://bugs.php.net/fix.php?id=34528&r=isapi
Install GNU Sed:             http://bugs.php.net/fix.php?id=34528&r=gnused
Floating point limitations:  http://bugs.php.net/fix.php?id=34528&r=float
No Zend Extensions:          http://bugs.php.net/fix.php?id=34528&r=nozend
MySQL Configuration Error:   http://bugs.php.net/fix.php?id=34528&r=mysqlcfg

Reply via email to