|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #78776 Abstract method implementation from trait does not check "static"
Submitted: 2019-11-04 07:38 UTC Modified: 2019-12-18 14:50 UTC
From: mozafar dot gholami at gmail dot com Assigned: nikic (profile)
Status: Closed Package: Scripting Engine problem
PHP Version: 7.3.11 OS: Win 10
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:
49 - 4 = ?
Subscribe to this entry?

 [2019-11-04 07:38 UTC] mozafar dot gholami at gmail dot com
abstract methods should be implemented by child class and should not be static but when the implementation comes from a trait it cloud be static and code continue running without any problem. 

Test script:

abstract class A
    abstract public function createApp();

class B extends A
    use C;

trait C
    public static function createApp()
        echo "You should not be here";


Expected result:
Error for not implementing abstract method


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2019-11-04 07:55 UTC]
-Status: Open +Status: Verified -Package: PHP Language Specification +Package: Scripting Engine problem
 [2019-11-04 07:55 UTC]
Confirmed: <>
 [2019-11-05 13:17 UTC] rowan dot collins at gmail dot com
Specifically, the error when implementing the method directly is:

> Fatal error: Cannot make non static method A::createApp() static in class B

The error is displayed correctly if the base method is not abstract:
 [2019-12-18 14:50 UTC]
-Summary: Abstract method implementation in trait +Summary: Abstract method implementation from trait does not check "static" -Assigned To: +Assigned To: nikic
 [2019-12-18 14:56 UTC]
Automatic comment on behalf of
Log: Fixed bug #78776
 [2019-12-18 14:56 UTC]
-Status: Verified +Status: Closed
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Wed Jul 24 18:01:29 2024 UTC