Re: Declaration of Bar::__construct() must be compatible
| From: | Stephane Drouard | Date: | Fri, 27 Feb 2004 10:21:44 +0000 |
| Subject: | Re: Declaration of Bar::__construct() must be compatible | ||
| References: | 1 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-8205@lists.php.net to get a copy of this message | ||
== Quote from Andi Gutmans (andi@zend.com)'s article
> a) Don't check signature for constructors.
Constructors are definitely not virtual methods. So no reason to check signature.
Moreover, this is a non sense to declare constructors in interfaces or abstract constructors in
abstract classes.
> b) By default, don't check signature for inheritance *if* we're not
> inheriting from an abstract class. If it is an abstract class we should
> check the signature because it's a PHP 5 feature.
I assume "abstract class" includes interfaces.
> c) Add a new INI option (zend.strict_inheritance_checks) which does check
> signature for methods (except for constructor). I don't like new INI
> options but I don't think there's any way out.
Because we could discover some other compatibility problems when moving to PHP5, what about an INI
option using flags, same as error_reporting.
For exemple zend.php5_compat and one of it's flag NO_STRICT_INHERITANCE.
Another flag could be SET_CLONE to have "$obj2 = $obj;" or "foo($obj);"
compatible with PHP4 (a clone rather than a reference). Indeed I think there will be some side
effects when executing some PHP4 code under PHP5.
Regards,
Stephane