|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #68438 Can not inherit abstract function to extend its syntax
Submitted: 2014-11-17 19:06 UTC Modified: 2016-04-16 13:41 UTC
Avg. Score:5.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:1 (100.0%)
Same OS:1 (100.0%)
From: someone dot wanted dot to dot be dot unknown at gmail dot com Assigned:
Status: Duplicate Package: Reproducible crash
PHP Version: Irrelevant 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:
31 - 15 = ?
Subscribe to this entry?

 [2014-11-17 19:06 UTC] someone dot wanted dot to dot be dot unknown at gmail dot com
My code class A, that defined abstract method `method` with one argument.
After that class B extends A. In this place I can not extend signature of `method` (for example, add new required arguments).
Code is following.
That's strange and non-intuitive behavior.
This bug is appearing on PHP 5.0.0 - 5.6.3.

Test script:
abstract class A {
    abstract function method($a);

abstract class B extends A {
    abstract function method($a, $b);

Expected result:
none printable result

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


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2014-11-17 19:08 UTC] someone dot wanted dot to dot be dot unknown at gmail dot com
I saw previously reported bugs, but this is NOT about inheriting method in interfaces, but in classes. It is not fix for now.
 [2016-04-16 13:41 UTC]
-Status: Open +Status: Duplicate
 [2016-04-16 13:41 UTC]
This will certainly not be allowed, as it violates LSP. I'm closing this as a duplicate of bug #63384 to track the unhelpful error message (it should be complaining about the signature mismatch instead).
PHP Copyright © 2001-2022 The PHP Group
All rights reserved.
Last updated: Sat Nov 26 16:05:52 2022 UTC