Bug #76870 [Opn->Dup]: Can override static with non-static method if imported by trait

From: Date: Wed, 08 Jan 2020 13:37:35 +0000
Subject: Bug #76870 [Opn->Dup]: Can override static with non-static method if imported by trait
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-224778@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=76870&edit=1 ID: 76870 Updated by: nikic@php.net Reported by: nikic@php.net Summary: Can override static with non-static method if imported by trait -Status: Open +Status: Duplicate Type: Bug Package: Scripting Engine problem PHP Version: Irrelevant Block user comment: N Private report: N New Comment: Apparently I fixed this in bug #78776 in the meantime. Previous Comments: ------------------------------------------------------------------------ [2018-09-12 13:53:32] nikic@php.net Description: ------------ 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: --------------- <?php 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: -------------- Nothing ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=76870&edit=1

« previous php.bugs (#224778) next »