From: dev at jurajsplayground dot com
Operating system: Ubuntu
PHP version: 5.4.9
Package: Reflection related
Bug Type: Bug
Bug description:Relative namespace import causes getClass() method to throw an
exception
Description:
------------
While importing of namespaced classes via relative namespace directive
works when
creating objects, ReflectionParameter::getClass() has a problem with it and
throws an exception that such class cannot be found.
Test script:
---------------
namespace Foo\Bar;
use A\B\BInterface;
class Bar implements BarInterface {
public function __construct()
{
echo "Hello!";
}
public function getSomething(BInterface $b){}
}
namespace Foo\Bar;
use A\B\BInterface;
interface BarInterface {
public function getSomething(BInterface $b);
}
namespace Foo\Bar\A\B;
interface BInterface {}
namespace TestNamespace;
$obj = new \Foo\Bar\Bar();
$ref = new \ReflectionMethod("\\Foo\Bar\Bar", "getSomething");
echo current($ref->getParameters())->getClass();
Expected result:
----------------
Should display interface information
Actual result:
--------------
ReflectionException is thrown: Class A\B\BInterface does not exist
--
Edit bug report at https://bugs.php.net/bug.php?id=63665&edit=1
--
Try a snapshot (PHP 5.4):
https://bugs.php.net/fix.php?id=63665&r=trysnapshot54
Try a snapshot (PHP 5.3):
https://bugs.php.net/fix.php?id=63665&r=trysnapshot53
Try a snapshot (trunk):
https://bugs.php.net/fix.php?id=63665&r=trysnapshottrunk
Fixed in SVN: https://bugs.php.net/fix.php?id=63665&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=63665&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=63665&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=63665&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=63665&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=63665&r=support
Expected behavior: https://bugs.php.net/fix.php?id=63665&r=notwrong
Not enough info:
https://bugs.php.net/fix.php?id=63665&r=notenoughinfo
Submitted twice:
https://bugs.php.net/fix.php?id=63665&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=63665&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=63665&r=php4
Daylight Savings: https://bugs.php.net/fix.php?id=63665&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=63665&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=63665&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=63665&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=63665&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=63665&r=mysqlcfg