ID:          24637
 Updated by:  [EMAIL PROTECTED]
 Reported By: Bertrand dot Willm at laposte dot net
-Status:      Open
+Status:      Feedback
 Bug Type:    Class/Object related
 PHP Version: 5.0.0b1 (beta1)
 New Comment:

Try this simple CLI command:
php -n -r 'class t { function __destruct() { echo "Bla\n";} } $o= new
t;'

For me it outputs Bla what means the destructor is called during
shutdown. However it is possible that one of my pending patches causes
the correct behavior. Please verify again.


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

[2003-07-16 01:04:22] Bertrand dot Willm at laposte dot net

I did not see any difference with this new release.

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

[2003-07-14 15:29:40] [EMAIL PROTECTED]

Please try using this CVS snapshot:

  http://snaps.php.net/php5-latest.tar.gz
 
For Windows:
 
  http://snaps.php.net/win32/php5-win32-latest.zip



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

[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 PROTECTED]

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.

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

[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 http://bugs.php.net/?id=24637&edit=1

Reply via email to