Bug #79605 [NEW]: ReflectionMethod reports wrong name of aliased trait method used by a class

From: Date: Fri, 15 May 2020 17:30:37 +0000
Subject: Bug #79605 [NEW]: ReflectionMethod reports wrong name of aliased trait method used by a class
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-227058@lists.php.net to get a copy of this message
From: ondrej at mirtes dot cz Operating system: Any PHP version: 7.4.6 Package: Reflection related Bug Type: Bug Bug description:ReflectionMethod reports wrong name of aliased trait method used by a class Description: ------------ ReflectionMethod reports wrong name of aliased trait method used by a class. I'd expect the same name the ReflectionMethod was fetched as (parentFooMethod). Test script: --------------- <?php trait BazTrait { public function fooMethod(): void { } } trait BarTrait { use BazTrait { fooMethod as parentFooMethod; } public function fooMethod(): void { $this->fooMethod(); $this->parentFooMethod(); } } class Foo { use BarTrait; public function doFoo(): void { $this->fooMethod(); $this->parentFooMethod(); } } $bar = new \ReflectionClass(BarTrait::class); var_dump($bar->getMethod('parentFooMethod')->getName()); $foo = new \ReflectionClass(Foo::class); var_dump($foo->hasMethod('parentFooMethod')); var_dump($foo->getMethod('parentFooMethod')->getName()); Expected result: ---------------- string(15) "parentFooMethod" bool(true) string(9) "parentFooMethod" Actual result: -------------- string(15) "parentFooMethod" bool(true) string(9) "fooMethod" -- Edit bug report at https://bugs.php.net/bug.php?id=79605&edit=1 -- Fix committed: https://bugs.php.net/fix.php?id=79605&r=fixed Fixed in release: https://bugs.php.net/fix.php?id=79605&r=alreadyfixed Need backtrace: https://bugs.php.net/fix.php?id=79605&r=needtrace Need Reproduce Script: https://bugs.php.net/fix.php?id=79605&r=needscript Try newer version: https://bugs.php.net/fix.php?id=79605&r=oldversion Not developer issue: https://bugs.php.net/fix.php?id=79605&r=support Expected behavior: https://bugs.php.net/fix.php?id=79605&r=notwrong Not enough info: https://bugs.php.net/fix.php?id=79605&r=notenoughinfo Submitted twice: https://bugs.php.net/fix.php?id=79605&r=submittedtwice register_globals: https://bugs.php.net/fix.php?id=79605&r=globals PHP version support discontinued: https://bugs.php.net/fix.php?id=79605&r=phptooold Daylight Savings: https://bugs.php.net/fix.php?id=79605&r=dst IIS Stability: https://bugs.php.net/fix.php?id=79605&r=isapi Install GNU Sed: https://bugs.php.net/fix.php?id=79605&r=gnused Floating point limitations: https://bugs.php.net/fix.php?id=79605&r=float No Zend Extensions: https://bugs.php.net/fix.php?id=79605&r=nozend MySQL Configuration Error: https://bugs.php.net/fix.php?id=79605&r=mysqlcfg

« previous php.bugs (#227058) next »