#34019 [Asn->Csd]: Implementing interface with a __construct method strange behaviour
| From: | stochnagara at hotmail dot com | Date: | Thu, 01 Jun 2006 09:47:19 +0000 |
| Subject: | #34019 [Asn->Csd]: Implementing interface with a __construct method strange behaviour | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-97909@lists.php.net to get a copy of this message | ||
ID: 34019
User updated by: stochnagara at hotmail dot com
Reported By: stochnagara at hotmail dot com
-Status: Assigned
+Status: Closed
Bug Type: Class/Object related
Operating System: *
-PHP Version: 5CVS-2005-08-07
+PHP Version: 5.2
Assigned To: helly
New Comment:
This bug seems to be fixed now.
Previous Comments:
------------------------------------------------------------------------
[2006-03-05 19:24:59] helly@php.net
Fixed in head now
------------------------------------------------------------------------
[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