Bug #79636 [Opn->Dup]: ReflectionMethod returns wrong method name for aliases
| From: | nikic@php.net | Date: | Tue, 26 May 2020 15:16:31 +0000 |
| Subject: | Bug #79636 [Opn->Dup]: ReflectionMethod returns wrong method name for aliases | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-227177@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
Updated by: nikic@php.net
Reported by: david at grudl dot com
Summary: ReflectionMethod returns wrong method name for
aliases
-Status: Open
+Status: Duplicate
Type: Bug
Package: Reflection related
PHP Version: 7.4.6
Block user comment: N
Private report: N
New Comment:
Duplicate of bug #69180, fixed in PHP 8.
Previous Comments:
------------------------------------------------------------------------
[2020-05-26 15:09:08] david at grudl dot com
To clarify: the main problem is that in the class 'C' there can be also another and
different method 'foo'.
https://3v4l.org/T79sZ
------------------------------------------------------------------------
[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