Bug in reflectionMethod::getPrototype() ?
| From: | Frederic Hardy | Date: | Sat, 21 Aug 2010 15:19:44 +0000 |
| Subject: | Bug in reflectionMethod::getPrototype() ? | ||
| Groups: | php.internals | ||
| Request: | Send a blank email to internals+get-49483@lists.php.net to get a copy of this message | ||
Hello !
During french PHP test fest, i have tested ReflectionMethod::getPrototype(), and the result is... strange.
This is the PHPT file :
--TEST--
--FILE--
<?php
class Hello {
public function sayHelloTo($name) {}
}
class HelloWorld extends Hello {
public function sayHelloTo($name) {}
}
$reflectionMethod = new ReflectionMethod('HelloWorld', 'sayHelloTo');
$prototype = $reflectionMethod->getPrototype();
echo $prototype->class . '::' . $prototype->name;
?>
--EXPECT--
Hello::sayHelloTo
In my opinion, result is strange because i'm expecting HelloWorld::sayHelloTo instead of Hello::sayHelloTo.
More strange, if i'm using 'Hello' as class instead of 'HelloWorld' as first argument of ReflectionMethod constructor, ReflectionMethod::getPrototype() throw an exception because for PHP, Hello::sayHelloTo() method has no prototype...
So, i think there is a problem.
Your opinion ?
Best regards,
Fred
--
========================================================================
Frédéric Hardy : Architecte d'application/Admin. système/Ergonome
Status : En recherche d'emploi
CV : http://blog.mageekbox.net/public/cv.frederic.hardy.pdf
Blog : http://blog.mageekbox.net
Twitter : http://twitter.com/mageekguy
========================================================================