|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #35057 abstract method inheritance and interface implementation problem
Submitted: 2005-11-01 21:12 UTC Modified: 2005-11-01 21:53 UTC
Avg. Score:5.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:0 (0.0%)
Same OS:0 (0.0%)
From: antonsub at pochtamt dot ru Assigned:
Status: Not a bug Package: Scripting Engine problem
PHP Version: 5.1.0RC4 OS: Linux
Private report: No CVE-ID: None
View Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please !
Your email address:
Solve the problem:
47 + 6 = ?
Subscribe to this entry?

 [2005-11-01 21:12 UTC] antonsub at pochtamt dot ru
Code given produces fatal error:
Can't inherit abstract function A::foo() (previously declared abstract in B) in foo.php on line 20

Reproduce code:
interface A
    public function foo($id);

abstract class B
    abstract public function foo($id);

class C extends B
    public function foo($id)
        echo "foo\n";

class D extends C implements A {}

var_dump(new D);

Expected result:
But is expected to run cleanly.


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2005-11-01 21:53 UTC]
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at and the instructions on how to report
a bug at

B::foo is not A::foo, so when C inherits B it gets B::foo and when it implements A it gets A:foo, obviously A::foo and B::foo are different. That\'s what the error tells you.
 [2012-02-02 22:02 UTC]
see #43200
PHP Copyright © 2001-2022 The PHP Group
All rights reserved.
Last updated: Sun May 22 05:05:45 2022 UTC