Bug #79636 [Com]: ReflectionMethod returns wrong method name for aliases

From: Date: Tue, 26 May 2020 15:09:08 +0000
Subject: Bug #79636 [Com]: ReflectionMethod returns wrong method name for aliases
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-227176@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=79636&edit=1 ID: 79636 Comment by: david at grudl dot com Reported by: david at grudl dot com Summary: ReflectionMethod returns wrong method name for aliases Status: Open Type: Bug Package: Reflection related PHP Version: 7.4.6 Block user comment: N Private report: N New Comment: To clarify: the main problem is that in the class 'C' there can be also another and different method 'foo'. https://3v4l.org/T79sZ Previous Comments: ------------------------------------------------------------------------ [2020-05-26 14:48:49] david at grudl dot com Description: ------------ Directly created object ReflectionMethod returns wrong method name when method is aliased. As opposite, ReflectionClass::getMethod() returns correct name. It affects PHP since 5.4 https://3v4l.org/Nlm9C Test script: --------------- <?php trait A { function foo() { } } class C { use A { A::foo as alias; } } $rm = new ReflectionMethod('C', 'alias'); echo $rm->name; // returns 'foo' echo "\n"; echo (new ReflectionClass('C'))->getMethod('alias')->name; // returns 'alias' Expected result: ---------------- Should return 'alias' in the both cases. ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=79636&edit=1

« previous php.bugs (#227176) next »