ID:               43557
 Updated by:       [EMAIL PROTECTED]
 Reported By:      michikono at gmail dot com
 Status:           Open
 Bug Type:         Class/Object related
 Operating System: linux
 PHP Version:      5.2.5
 New Comment:

PHP 5.3:

Fatal error: Declaration of Test::__construct() must be compatible with
that of TestInterface::__construct()


Previous Comments:
------------------------------------------------------------------------

[2007-12-10 23:40:50] michikono at gmail dot com

Description:
------------
When trying to enforce arguments on constructors, PHP behaves
unexpectedly. If you define the constructor as an abstract method in a
parent level class, the __construct method argument datatype/count
checks go out the window in children. This issue is the same whether its
in an interface or abstract class.

Reproduce code:
---------------
class ExampleClass {}

interface TestInterface {
        public function __construct(ExampleClass $var);
}

class Test implements TestInterface {
        public function __construct() {} // NO ERROR (unexpected)
}



Expected result:
----------------
Should produce an error

Actual result:
--------------
No error is reported.


------------------------------------------------------------------------


-- 
Edit this bug report at http://bugs.php.net/?id=43557&edit=1

Reply via email to