#43264 [Opn->Bgs]: __destruct
| From: | johannes@php.net | Date: | Mon, 12 Nov 2007 17:38:18 +0000 |
| Subject: | #43264 [Opn->Bgs]: __destruct | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-119561@lists.php.net to get a copy of this message | ||
ID: 43264
Updated by: johannes@php.net
Reported By: miha dot vrhovnik at domenca dot com
-Status: Open
+Status: Bogus
Bug Type: Feature/Change Request
Operating System: Linux
PHP Version: 5.2.5
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
PHP is a unique language and there isn't even a parent class to your
base class, so there's no class which could offer such a feature. Adding
some magic won't fit to the engine.
Previous Comments:
------------------------------------------------------------------------
[2007-11-12 14:26:35] miha dot vrhovnik at domenca dot com
Description:
------------
PHP 5.2.4 doesn't provide default class destructor and exits with
Fatal error: Call to undefined method base::__destruct() in
/path/to/bug.php on line 23
For me coming from Delphi waters this is a bug.
If php would provide default class destructor you could write future
proof code
I think that there is no need to explain what I mean with that
especially after reading this in documentation:
> 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.
Reproduce code:
---------------
error_reporting(E_ALL);
$c = new extender();
class base
{
public function __constructor()
{
parent::__construct();
}
}
class extender extends base
{
public function __constructor()
{
parent::__construct();
}
public function __destruct()
{
parent::__destruct();
}
}
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=43264&edit=1