|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #47019 \ReflectionParameter->getClass()->getName() is broken.
Submitted: 2009-01-06 11:49 UTC Modified: 2009-02-03 18:58 UTC
Avg. Score:1.0 ± 0.0
Reproduced:0 of 2 (0.0%)
From: daniel dot gorski at develnet dot org Assigned:
Status: Not a bug Package: Reflection related
PHP Version: 5.3CVS-2009-01-06 (CVS) OS: Linux
Private report: No CVE-ID: None
 [2009-01-06 11:49 UTC] daniel dot gorski at develnet dot org
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:

Actual result:


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2009-02-03 18:58 UTC]
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at and the instructions on how to report
a bug at

Leading slash is not a part of the class name. Try this:

namespace test;

class test {
  static function foo() { echo __CLASS__; }

PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Jul 25 11:01:30 2024 UTC