ID: 31207 Updated by: [EMAIL PROTECTED] Reported By: mileskeaton at gmail dot com -Status: Open +Status: Bogus Bug Type: Zend Engine 2 problem Operating System: FreeBSD / any PHP Version: 5.0.3 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 In the first case the method is till abstract, hence the class must be abstract. In the other two cases we do not allow the superflous re-declaration of the abstract methods (maybe this is a feature request you want). In general use 'ReflectionClass::export("YOURCLASSNAME")' Previous Comments: ------------------------------------------------------------------------ [2004-12-20 18:19:17] mileskeaton at gmail dot com Description: ------------ A typical OOP use of the Command Pattern (design pattern) is to have an interface, an abstract class that leaves the interface methods as abstract, then a subclass that implements the methods (now named in both interface and abstract class). PHP5 wrongly complains that an interface method can not be implemented as an abstract method in an abstract class. As a side-effect, it seems NOT to complain when an abstract class does *not* implement the methods named in its interface. Reproduce code: --------------- #1 - Abstract class not implementing interface method - WORKS but should not! interface MyInterface { function play(); } abstract class MyAbstractClass implements MyInterface { } #2 - Abstract class implementing interface method as abstract - DOES NOT WORK but should interface MyInterface { function play(); } abstract class MyAbstractClass implements MyInterface { abstract function play(); } #3 - Normal OO use of interface and abstract class, but DOES NOT WORK interface MyInterface { function play(); } abstract class MyAbstractClass implements MyInterface { abstract function play(); } class MyClass extends MyAbstractClass { function play() { print "Playing\n"; } } $x = new MyClass; $x->play(); Expected result: ---------------- #1 - Class (even if Abstract class) not implementing interface method should fail. #2 - Abstract class that implements interface method as abstract method should not fail (expecting that actual method would come in subclass) #3 - Normal OO use of interface and abstract class should let subclass use of that interface/abstract method work. Actual result: -------------- #1 - No error #2 - Fatal error: Can't inherit abstract function MyInterface::play() (previously declared abstract in MyAbstractClass) #3 - Fatal error: Can't inherit abstract function MyInterface::play() (previously declared abstract in MyAbstractClass) ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=31207&edit=1