ID: 24637
Updated by: [email]hellyphp.net[/email]
Reported By: Bertrand dot Willm at laposte dot net
-Status: Bogus
+Status: Feedback
Bug Type: Class/Object related
Operating System: Windows XP
PHP Version: 5.0.0b1 (beta1)
New Comment:

Please try using this CVS snapshot:

[url]http://snaps.php.net/php5-latest.tar.gz[/url]

For Windows:

[url]http://snaps.php.net/win32/php5-win32-latest.zip[/url]




Previous Comments:
------------------------------------------------------------------------

[2003-07-14 15:24:40] Bertrand dot Willm at laposte dot net

I probably make an error entering the bug.
What should be read is:

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

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

------------------------------------------------------------------------

[2003-07-14 14:20:04] [email]hellyphp.net[/email]

Thank you for taking the time to write to us, but this is not
a bug. Please double-check the doentation available at
[url]http://www.php.net/manual/[/url] and the instructions on how to report
a bug at [url]http://bugs.php.net/how-to-report.php[/url]

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.

------------------------------------------------------------------------

[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-&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 this bug report at [url]http://bugs.php.net/?id=24637&edit=1[/url]