Bug #79636 [NEW]: ReflectionMethod returns wrong method name for aliases
| From: | david at grudl dot com | Date: | Tue, 26 May 2020 14:48:50 +0000 |
| Subject: | Bug #79636 [NEW]: ReflectionMethod returns wrong method name for aliases | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-227174@lists.php.net to get a copy of this message | ||
From: david at grudl dot com
Operating system:
PHP version: 7.4.6
Package: Reflection related
Bug Type: Bug
Bug description:ReflectionMethod returns wrong method name for aliases
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 bug report at https://bugs.php.net/bug.php?id=79636&edit=1
--
Fix committed: https://bugs.php.net/fix.php?id=79636&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=79636&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=79636&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=79636&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=79636&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=79636&r=support
Expected behavior: https://bugs.php.net/fix.php?id=79636&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=79636&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=79636&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=79636&r=globals
PHP version support discontinued: https://bugs.php.net/fix.php?id=79636&r=phptooold
Daylight Savings: https://bugs.php.net/fix.php?id=79636&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=79636&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=79636&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=79636&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=79636&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=79636&r=mysqlcfg