Edit report at https://bugs.php.net/bug.php?id=64235&edit=1
ID: 64235 Patch added by: larue...@php.net Reported by: imenem at inox dot ru Summary: Insteadof not work for class method in 5.4.11 Status: Assigned Type: Bug Package: Scripting Engine problem Operating System: Debian GNU/Linux PHP Version: 5.4.11 Assigned To: dmitry Block user comment: N Private report: N New Comment: The following patch has been added/updated: Patch Name: bug64235.patch Revision: 1361345980 URL: https://bugs.php.net/patch-display.php?bug=64235&patch=bug64235.patch&revision=1361345980 Previous Comments: ------------------------------------------------------------------------ [2013-02-20 07:15:37] larue...@php.net actually, I was looking into this, I have thought the similar fix of you, but unfortunatly, it is wrong, thinking of this: <?php class TestParentClass { public function method() { print_r('Parent method'); print "\n"; } } trait TestTrait { public function method() { print_r('Trait method'); print "\n"; } } class TestChildClass extends TestParentClass { use TestTrait { TestParentClass::method as methodParent; } } (new TestChildClass)->methodParent(); ~ ------------------------------------------------------------------------ [2013-02-20 07:00:53] re...@php.net Hi dmitry, will you take a look please. ------------------------------------------------------------------------ [2013-02-18 11:58:23] imenem at inox dot ru Description: ------------ In PHP 5.4.4 test script works as expected, in 5.4.11 script caused fatal error. Test script: --------------- <?php class TestParentClass { public function method() { print_r('Parent method'); print "\n"; } } trait TestTrait { public function method() { print_r('Trait method'); print "\n"; } } class TestChildClass extends TestParentClass { use TestTrait { TestTrait::method as methodAlias; TestParentClass::method insteadof TestTrait; } } (new TestChildClass)->method(); (new TestChildClass)->methodAlias(); Expected result: ---------------- Parent method Trait method Actual result: -------------- Fatal error: Trait TestParentClass is not used in test.php on line 28 ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=64235&edit=1