#34019 [Opn->Asn]: Implementing interface with a __construct method strange behaviour
| From: | tony2001@php.net | Date: | Wed, 11 Jan 2006 13:49:16 +0000 |
| Subject: | #34019 [Opn->Asn]: Implementing interface with a __construct method strange behaviour | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-91769@lists.php.net to get a copy of this message | ||
ID: 34019
Updated by: tony2001@php.net
Reported By: stochnagara at hotmail dot com
-Status: Open
+Status: Assigned
Bug Type: Class/Object related
Operating System: *
PHP Version: 5CVS-2005-08-07
Assigned To: helly
Previous Comments:
------------------------------------------------------------------------
[2005-08-06 23:39:27] helly@php.net
I think we should either disable __construct/__destruct enforcement or
ensure the interface rules apply since that is imho the only thing that
would make sense.
------------------------------------------------------------------------
[2005-08-06 14:09:09] stochnagara at hotmail dot com
Description:
------------
When a class implements an interface which declares a funciton
__construct with a given prototype and the class does not follow this
prototype, then PHP does not raise a fatal error like in all other
cases.
I know that __construct has a lot of special features but I think we
need at least a notice for that.
Reproduce code:
---------------
interface constr {
function __construct();
}
class implem implements constr {
function __construct ($a) {
}
}
Expected result:
----------------
Fatal error: Declaration of implem::__construct() must be compatible
with that of constr::__construct() in ...
Actual result:
--------------
5
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=34019&edit=1