|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #69110 Abstract method inheritance behaves differently from concrete inheritance
Submitted: 2015-02-23 17:14 UTC Modified: 2016-04-16 13:39 UTC
From: draconyster at gmai dot com Assigned:
Status: Duplicate Package: Scripting Engine problem
PHP Version: Irrelevant OS:
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
Block user comment
Status: Assign to:
Bug Type:
From: draconyster at gmai dot com
New email:
PHP Version: OS:


 [2015-02-23 17:14 UTC] draconyster at gmai dot com
When extending abstract classes you are not allowed to change an abstract method's signature to a compatible one. This works perfectly fine for concrete classes though.

Test script:
//This code works:

class A { 
    public function a () {}

class B extends A { 
    public function a ($t = false) {}

//this code throws an error:

abstract class A { 
    abstract public function a ();

abstract class B extends A { 
    abstract public function a ($t = false);

Expected result:
Extending an abstract method should behaves consistently with extending concrete methods

Actual result:
Fatal error:  Can't inherit abstract function A::a() (previously declared abstract in B)


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2016-04-16 13:39 UTC]
-Status: Open +Status: Duplicate
 [2016-04-16 13:39 UTC]
Duplicate of bug #63384.
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Tue Jun 18 00:01:32 2024 UTC