Bug #78776 [Ver->Csd]: Abstract method implementation from trait does not check "static"

From: Date: Wed, 18 Dec 2019 14:56:22 +0000
Subject: Bug #78776 [Ver->Csd]: Abstract method implementation from trait does not check "static"
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-224394@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=78776&edit=1 ID: 78776 Updated by: nikic@php.net Reported by: mozafar dot gholami at gmail dot com Summary: Abstract method implementation from trait does not check "static" -Status: Verified +Status: Closed Type: Bug Package: Scripting Engine problem Operating System: Win 10 PHP Version: 7.3.11 Assigned To: nikic Block user comment: N Private report: N New Comment: Automatic comment on behalf of nikita.ppv@gmail.com Revision: http://git.php.net/?p=php-src.git;a=commit;h=4a61d842e71c97868636dbf67432ad93189ee266 Log: Fixed bug #78776 Previous Comments: ------------------------------------------------------------------------ [2019-11-05 13:17:51] 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 https://3v4l.org/it0Se The error is displayed correctly if the base method is not abstract: https://3v4l.org/I2E5Y ------------------------------------------------------------------------ [2019-11-04 07:55:11] cmb@php.net Confirmed: <https://3v4l.org/WgSfr> ------------------------------------------------------------------------ [2019-11-04 07:38:20] mozafar dot gholami at gmail dot com Description: ------------ 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: --------------- <?php 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"; } } B::createApp(); Expected result: ---------------- Error for not implementing abstract method ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=78776&edit=1

« previous php.bugs (#224394) next »