From: sp0n9e at gmail dot com Operating system: Windows XP PHP version: 5.1.1 PHP Bug Type: Class/Object related Bug description: interface from extended class conflicts with interface of parent class
Description: ------------ when implementing interfaces that have common methods in a parent class and an extended class, the code below produces an error. if i provide a method in the child class, it works. it also works if the parent class doesn't implement its' interface. but i think i should be able to inherit from the parent class and satisfy both interfaces. though it would be easy in this example to "code around" the problem, i ran across this in a situation where it won't be quite as easy. Reproduce code: --------------- <?php interface gotsMyMethod { public function myMethod(); } class theparent implements gotsMyMethod { public function myMethod() { return "boo!"; } } interface iNeedsMyMethod { public function myMethod(); } class child extends theparent implements iNeedsMyMethod { } $child = new child(); echo $child->myMethod(); ?> Expected result: ---------------- I expect the code to run without any errors and output "boo!" Actual result: -------------- Fatal error: Can't inherit abstract function iNeedsMyMethod::myMethod() (previously declared abstract in gotsMyMethod) in C:\www\test\bug.php on line 13 -- Edit bug report at http://bugs.php.net/?id=35832&edit=1 -- Try a CVS snapshot (PHP 4.4): http://bugs.php.net/fix.php?id=35832&r=trysnapshot44 Try a CVS snapshot (PHP 5.1): http://bugs.php.net/fix.php?id=35832&r=trysnapshot51 Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=35832&r=trysnapshot60 Fixed in CVS: http://bugs.php.net/fix.php?id=35832&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=35832&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=35832&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=35832&r=needscript Try newer version: http://bugs.php.net/fix.php?id=35832&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=35832&r=support Expected behavior: http://bugs.php.net/fix.php?id=35832&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=35832&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=35832&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=35832&r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=35832&r=php3 Daylight Savings: http://bugs.php.net/fix.php?id=35832&r=dst IIS Stability: http://bugs.php.net/fix.php?id=35832&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=35832&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=35832&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=35832&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=35832&r=mysqlcfg