#47019 [Opn->Bgs]: \ReflectionParameter->getClass()->getName() is broken.
ID: 47019
Updated by: stas@php.net
Reported By: daniel dot gorski at develnet dot org
-Status: Open
+Status: Bogus
Bug Type: Reflection related
Operating System: Linux
PHP Version: 5.3CVS-2009-01-06 (CVS)
New Comment:
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to
report
a bug at http://bugs.php.net/how-to-report.php
Leading slash is not a part of the class name. Try this:
namespace test;
class test {
static function foo() { echo __CLASS__; }
}
test::foo();
Previous Comments:
------------------------------------------------------------------------
[2009-01-06 11:49:57] daniel dot gorski at develnet dot org
Description:
------------
The \ReflectionParameter->getClass()->getName() method returns a wrong
value. It omits the leading namespace slash.
Reproduce code:
---------------
namespace A\B\C;
class Bar {}
namespace D;
class Foo { function foo(\A\B\C\Bar $x) {} }
$rm = new \ReflectionMethod('\D\Foo', 'foo');
$rp = $rm->getParameters();
echo $rp[0]->getClass()->getName();
Expected result:
----------------
\A\B\C\Bar
Actual result:
--------------
A\B\C\Bar
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=47019&edit=1
Thread (3 messages)