|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #76870 Can override static with non-static method if imported by trait
Submitted: 2018-09-12 13:53 UTC Modified: 2020-01-08 13:37 UTC
Avg. Score:3.5 ± 0.5
Reproduced:2 of 2 (100.0%)
Same Version:0 (0.0%)
Same OS:0 (0.0%)
From: 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:
New email:
PHP Version: OS:


 [2018-09-12 13:53 UTC]
An abstract static method can be overridden by a non-static method in a child class if it originates from a trait. Usually this would generate a compile error.

Test script:

trait T {
    public function foo() {}

abstract class A {
    abstract static function foo();

class B extends A {
    // This throws an error:
    // Cannot make static method A::foo() non static in class B
    //public function foo() {}

    // This doesn't:
    use T;

Expected result:
Fatal error: Cannot make static method A::foo() non static in class B

Actual result:


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2020-01-08 13:37 UTC]
-Status: Open +Status: Duplicate
 [2020-01-08 13:37 UTC]
Apparently I fixed this in bug #78776 in the meantime.
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Mar 02 03:01:29 2024 UTC