From:             Bertrand dot Willm at laposte dot net
Operating system: Windows XP
PHP version:      5.0.0b1 (beta1)
PHP Bug Type:     Class/Object related
Bug description:  __destruct not called

Description:
------------
There is no recursive call to __destruct when it is not defined in a
derived class.
There is not this problem with __construct.
This can be dangerous be cause if a destructor is declared, all the
derived clas have to declare a __destruct to be sure that the destruction
is done.
In other way __destruct is obligatory not to have problem, but this is not
flexible.

Reproduce code:
---------------
class CBaseClass {
   var $name;
   function __construct($name) {
      $this->name = $name;
      echo "$this->name-&gt;CBaseClass::__construct()<br>";
   }
   
   function __destruct() {
      echo "$this->name-&gt;CBaseClass::__destruct()<br>";
   }
}

class CExtClass extends CBaseClass {
}

echo 'Creation of ExtObject<br>';
$ExtObject = new CExtClass('ExtObject');

echo 'End of script<br>';


Expected result:
----------------
Creation of ExtObject
ExtObject->CBaseClass::__construct()
End of script


Actual result:
--------------
Creation of ExtObject
ExtObject->CBaseClass::__construct()
End of script
ExtObject->CBaseClass::__destruct()


-- 
Edit bug report at http://bugs.php.net/?id=24637&edit=1
-- 
Try a CVS snapshot (php4):  http://bugs.php.net/fix.php?id=24637&r=trysnapshot4
Try a CVS snapshot (php5):  http://bugs.php.net/fix.php?id=24637&r=trysnapshot5
Fixed in CVS:               http://bugs.php.net/fix.php?id=24637&r=fixedcvs
Fixed in release:           http://bugs.php.net/fix.php?id=24637&r=alreadyfixed
Need backtrace:             http://bugs.php.net/fix.php?id=24637&r=needtrace
Try newer version:          http://bugs.php.net/fix.php?id=24637&r=oldversion
Not developer issue:        http://bugs.php.net/fix.php?id=24637&r=support
Expected behavior:          http://bugs.php.net/fix.php?id=24637&r=notwrong
Not enough info:            http://bugs.php.net/fix.php?id=24637&r=notenoughinfo
Submitted twice:            http://bugs.php.net/fix.php?id=24637&r=submittedtwice
register_globals:           http://bugs.php.net/fix.php?id=24637&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=24637&r=php3
Daylight Savings:           http://bugs.php.net/fix.php?id=24637&r=dst
IIS Stability:              http://bugs.php.net/fix.php?id=24637&r=isapi
Install GNU Sed:            http://bugs.php.net/fix.php?id=24637&r=gnused

Reply via email to