Bug #66376 [Csd->ReO]: ReflectionClass::getPrototype returns ReflectionMethod which does not exist

From: Date: Sun, 13 Jul 2014 23:05:22 +0000
Subject: Bug #66376 [Csd->ReO]: ReflectionClass::getPrototype returns ReflectionMethod which does not exist
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-186603@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: yohgaki@php.net Reported by: rudgergravestein at gmail dot com Summary: ReflectionClass::getPrototype returns ReflectionMethod which does not exist -Status: Closed +Status: Re-Opened 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: Oops. Master is fine, but it's still broken 5.4.11 - 5.6.0RC2. Previous Comments: ------------------------------------------------------------------------ [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

« previous php.bugs (#186603) next »