Re: Cannot call constructor
| From: | Stas Malyshev | Date: | Thu, 23 May 2013 21:32:11 +0000 |
| Subject: | Re: Cannot call constructor | ||
| References: | 1 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-67468@lists.php.net to get a copy of this message | ||
Hi!
> Right now, to avoid this situation, you have to do:
> if (method_exists(get_parent_class(), '__construct'))
> parent::__construct();
>
> If you don't check for the method existing, you get:
> Fatal error: Cannot call constructor ...
This makes a lot of sense. I think we also discussed this idea some time
ago, but it didn't go anywhere that time... Right now I add empty ctor
in almost all base classes just because of this thing. I think having
implicit empty ctor would make a lot of things easier. Same would
probably do for dtor. How about creating an RFC about it? :)
--
Stanislav Malyshev, Software Architect
SugarCRM: http://www.sugarcrm.com/
(408)454-6900 ext. 227