Bug #52730 [Opn->Bgs]: Impossible to implement Interfaces with same method names
| From: | felipe@php.net | Date: | Sun, 29 Aug 2010 15:19:36 +0000 |
| Subject: | Bug #52730 [Opn->Bgs]: Impossible to implement Interfaces with same method names | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-153899@lists.php.net to get a copy of this message | ||
Edit report at http://bugs.php.net/bug.php?id=52730&edit=1
ID: 52730
Updated by: felipe@php.net
Reported by: wrzasq at gmail dot com
Summary: Impossible to implement Interfaces with same method
names
-Status: Open
+Status: Bogus
Type: Bug
Package: Scripting Engine problem
Operating System: Debian
PHP Version: 5.3.3
Block user comment: N
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
There is a note in the documentation about this. See
http://docs.php.net/interface
Thanks.
Previous Comments:
------------------------------------------------------------------------
[2010-08-29 15:43:13] wrzasq at gmail dot com
Sorry, a little misstake - of course classes B in case two and three
extend classes A.
------------------------------------------------------------------------
[2010-08-29 13:02:13] wrzasq at gmail dot com
Description:
------------
It's impossible to implement interfaces with same method names. Whath's
the most strange is, that you can simply "hack" this by implementing
each interface at different inheritance level.
(it's in fact PHP 5.3.2 issue, but I didn't see it fixed in PHP 5.3.3)
Test script:
---------------
first case:
--
interface Foo
{
public function getID();
}
interface Bar
{
public function getID();
}
class A implements Foo, Bar
{
public function getID()
{
return 1;
}
}
second case:
--
interface Foo
{
public function getID();
}
interface Bar
{
public function getID();
}
class A implements Foo
{
public function getID()
{
return 1;
}
}
class B implements Bar
{
}
third case:
--
interface Foo
{
public function getID();
}
interface Bar
{
public function getID();
}
class A implements Foo
{
public function getID()
{
return 1;
}
}
class B implements Bar
{
public function getID()
{
return parent::getID();
}
}
Expected result:
----------------
Nothing at output, but all of them compile.
Actual result:
--------------
first case: Fatal error: Can't inherit abstract function Bar::getID()
(previously declared abstract in Foo) in Command line code on line 1
second case: Fatal error: Can't inherit abstract function Bar::getID()
(previously declared abstract in Foo) in Command line code on line 1
third case: worked fine
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/bug.php?id=52730&edit=1