ID: 34807 Updated by: [EMAIL PROTECTED] Reported By: daarius at hotmail dot com -Status: Open +Status: Bogus Bug Type: Class/Object related -Operating System: WinXP +Operating System: * -PHP Version: 5.0.5 +PHP Version: 5.* New Comment:
Thank you for taking the time to write to us, but this is not a bug. Please double-check the documentation available at http://www.php.net/manual/ and the instructions on how to report a bug at http://bugs.php.net/how-to-report.php You cannot redeclare methods in PHP. Reread the error message. Previous Comments: ------------------------------------------------------------------------ [2005-10-10 16:01:18] daarius at hotmail dot com I have tried the latest snapshot. The error is some on there too. ------------------------------------------------------------------------ [2005-10-10 12:32:22] [EMAIL PROTECTED] Please try using this CVS snapshot: http://snaps.php.net/php5-latest.tar.gz For Windows: http://snaps.php.net/win32/php5-win32-latest.zip ------------------------------------------------------------------------ [2005-10-10 12:27:02] daarius at hotmail dot com Description: ------------ The interface of a parent class is also forced to be implemented on to the children classes if they use methods with same name as in Interface. Even though the parent class has implemented the methods declared in the Interface legally. Reproduce code: --------------- interface MyInterface { public function Z($s); } class MyClass implements MyInterface { public function Z($s) {} } class MySubClass extends MyClass { public function Z() {} } Expected result: ---------------- Above should be legal (at least i think), because parent is implementing the interface, the child is just extending the parent's method. But, if we remove the method completely from child class, then there is no error message and Interface is no longer being forced on to child. This suggests inconsistency. Also, if we remove the interface from the code, then the parent child extension of the same method name is still legal, as the number of arguments is not being checked anymore. Actual result: -------------- Fatal error: Declaration of MySubClass::Z() must be compatible with that of MyInterface::Z() in C:\httpd\PHPObject3.0\index.php on line 12 ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=34807&edit=1