Bug #66376 [Asn->Csd]: ReflectionClass::getPrototype returns ReflectionMethod which does not exist
| From: | carusogabriel@php.net | Date: | Sun, 05 Aug 2018 03:48:25 +0000 |
| Subject: | Bug #66376 [Asn->Csd]: ReflectionClass::getPrototype returns ReflectionMethod which does not exist | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-216593@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=66376&edit=1
ID: 66376
Updated by: carusogabriel@php.net
Reported by: rudgergravestein at gmail dot com
Summary: ReflectionClass::getPrototype returns
ReflectionMethod which does not exist
-Status: Assigned
+Status: Closed
Type: Bug
Package: Reflection related
Operating System: Ubuntu 12.04.2 LTS
PHP Version: 5.4.23
Assigned To: yohgaki
Block user comment: N
Private report: N
New Comment:
Closing as it was fixed: https://3v4l.org/Rd1Uk.
Previous Comments:
------------------------------------------------------------------------
[2014-07-13 23:05:22] yohgaki@php.net
Oops. Master is fine, but it's still broken 5.4.11 - 5.6.0RC2.
------------------------------------------------------------------------
[2014-07-13 23:03:33] yohgaki@php.net
Fixed
http://3v4l.org/EGPiQ
------------------------------------------------------------------------
[2013-12-31 12:53:39] rudgergravestein at gmail dot com
Description:
------------
Specific PHP version: PHP 5.4.23-1+sury.org~precise+1
ReflectionMethod::getPrototype â Gets the method prototype (if there is one).
Executing ReflectionClass::getPrototype on class methods, with the class using traits, returns a
ReflectionClass with reference to non-existing class methods (these are trait methods).
Test script:
---------------
<?php
trait t {
function f() {
//do stuff
}
}
class a {
function f() {
// do stuff
}
}
class c extends a {
use t;
}
$class = new ReflectionClass('c');
foreach ($class->getMethods() as $method) {
try {
printf('method %s::%s%s', $method->class, $method->name, PHP_EOL);
$prototype = $method->getPrototype();
printf('prototype %s::%s%s', $prototype->class, $prototype->name, PHP_EOL);
} catch (\ReflectionException $e) {
printf('%s%s', $e->getMessage(), PHP_EOL);
}
}
Expected result:
----------------
Two possible expected results:
method c::f
prototype a::f
or
method c::f
Method c::f does not have a prototype
Actual result:
--------------
method c::f
prototype c::f
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=66376&edit=1