#35832 [Opn->Fbk]: interface from extended class conflicts with interface of parent class
| From: | sniper@php.net | Date: | Wed, 28 Dec 2005 21:39:40 +0000 |
| Subject: | #35832 [Opn->Fbk]: interface from extended class conflicts with interface of parent class | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-91192@lists.php.net to get a copy of this message | ||
ID: 35832
Updated by: sniper@php.net
Reported By: sp0n9e at gmail dot com
-Status: Open
+Status: Feedback
Bug Type: Class/Object related
Operating System: Windows XP
PHP Version: 5.1.1
New Comment:
Please try using this CVS snapshot:
http://snaps.php.net/php5.1-latest.tar.gz
For Windows:
http://snaps.php.net/win32/php5.1-win32-latest.zip
Previous Comments:
------------------------------------------------------------------------
[2005-12-28 22:14:08] sp0n9e at gmail dot com
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 this bug report at http://bugs.php.net/?id=35832&edit=1