#36687 [NEW]: ReflectionParameter::getDeclaringClass returns wrong result

From: Date: Fri, 10 Mar 2006 21:19:13 +0000
Subject: #36687 [NEW]: ReflectionParameter::getDeclaringClass returns wrong result
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-94162@lists.php.net to get a copy of this message
From: elias at adaptiveinstance dot com Operating system: linux PHP version: 5CVS-2006-03-10 (snap) PHP Bug Type: Class/Object related Bug description: ReflectionParameter::getDeclaringClass returns wrong result Description: ------------ The method ReflectionParameter::getDeclaringClass() always return the wrong result. I should reaturn the reflection object of the declaring class and not that of the typehint class. Further this method has been introduced somewhere between php 5.0.5 and 5.1.3, but the documentation doesn't mention it. Reproduce code: --------------- class OtherClass {} class MyClass { function myMeth(OtherClass $param0, $param1){} } $class = new ReflectionClass('MyClass'); $params = $class->getMethod('myMeth')->getParameters(); var_dump($params[0]->getDeclaringClass()); var_dump($params[0]->getClass()); var_dump($params[1]->getDeclaringClass()); var_dump($params[1]->getClass()); Expected result: ---------------- object(ReflectionClass)#2 (1) { ["name"]=> string(10) "MyClass" } object(ReflectionClass)#2 (1) { ["name"]=> string(10) "OtherClass" } object(ReflectionClass)#2 (1) { ["name"]=> string(10) "MyClass" } NULL Actual result: -------------- object(ReflectionClass)#2 (1) { ["name"]=> string(10) "OtherClass" } object(ReflectionClass)#2 (1) { ["name"]=> string(10) "OtherClass" } NULL NULL -- Edit bug report at http://bugs.php.net/?id=36687&edit=1 -- Try a CVS snapshot (PHP 4.4): http://bugs.php.net/fix.php?id=36687&r=trysnapshot44 Try a CVS snapshot (PHP 5.1): http://bugs.php.net/fix.php?id=36687&r=trysnapshot51 Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=36687&r=trysnapshot60 Fixed in CVS: http://bugs.php.net/fix.php?id=36687&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=36687&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=36687&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=36687&r=needscript Try newer version: http://bugs.php.net/fix.php?id=36687&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=36687&r=support Expected behavior: http://bugs.php.net/fix.php?id=36687&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=36687&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=36687&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=36687&r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=36687&r=php3 Daylight Savings: http://bugs.php.net/fix.php?id=36687&r=dst IIS Stability: http://bugs.php.net/fix.php?id=36687&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=36687&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=36687&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=36687&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=36687&r=mysqlcfg

« previous php.bugs (#94162) next »