__destruct() behaviour
| From: | Ard Biesheuvel | Date: | Sat, 06 Mar 2004 17:21:38 +0000 |
| Subject: | __destruct() behaviour | ||
| Groups: | php.internals | ||
| Request: | Send a blank email to internals+get-8408@lists.php.net to get a copy of this message | ||
While http://www.php.net/zend-engine-2.php claims the following
'Like constructors, parent destructors will not be called
implicitly by the engine. In order to run a parent destructor,
one would have to explicitly call parent::__destruct() in the
destructor body.
the following code
php -r 'abstract class A { protected function __destruct() {} }
class B extends A {}
$b = new B;'
results in
Warning: Call to protected B::__destruct() from context ''
during shutdown ignored in Unknown on line 0
which is inconsistent with the quoted description.
It also introduces an asymmetry compared to constructors which I think is confusing.
Any thoughts ?
--
Ard