ID: 24637 Updated by: [EMAIL PROTECTED] Reported By: Bertrand dot Willm at laposte dot net -Status: Open +Status: Bogus Bug Type: Class/Object related Operating System: Windows XP PHP Version: 5.0.0b1 (beta1) New Comment:
Thank you for taking the time to write to us, but this is not a bug. Please double-check the documentation available at http://www.php.net/manual/ and the instructions on how to report a bug at http://bugs.php.net/how-to-report.php The instance is destructed of course after script termination if the script doesn't destroy it itself. And when a derived class has no specialized destructor then of course the inherited destructor is to be called. Previous Comments: ------------------------------------------------------------------------ [2003-07-13 15:33:01] Bertrand dot Willm at laposte dot net 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->CBaseClass::__construct()<br>"; } function __destruct() { echo "$this->name->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 this bug report at http://bugs.php.net/?id=24637&edit=1