|  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
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If this is not your bug, you can add a comment by following this link.
If this is your bug, but you forgot your password, you can retrieve your password here.
Bug Type:
From: antonsub at pochtamt dot ru
New email:
PHP Version: OS:


 [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: Thu May 19 05:05:44 2022 UTC