Edit report at https://bugs.php.net/bug.php?id=62218&edit=1
ID: 62218
Comment by: mail+php at requinix dot net
Reported by: titch at tut dot by
Summary: Namespace conflict with Reflection
Status: Open
Type: Bug
Package: Class/Object related
Operating System: Ubuntu 12.04
PHP Version: 5.4.3
Block user comment: N
Private report: N
New Comment:
So not resolved then? Okay. But not a bug.
As the error message states, PHP can't find MyProject\ReflectionObject. Because
it's not there. It's at \ReflectionObject.
a = new \ReflectionObject($this);
Read up: php.net/language.namespaces
Previous Comments:
------------------------------------------------------------------------
[2012-06-03 20:15:34] titch at tut dot by
sorry, comment "//500 Internal Server Error" was added while posting
remove it, cause namespace must be first directive at script
but it's doesn't fix problem with Reflection, it just misspast
------------------------------------------------------------------------
[2012-06-03 20:10:13] titch at tut dot by
Description:
------------
if namespace defined, ReflectionObject can't find class by name with namespace
prefix
[Sun Jun 03 22:56:50 2012] [error] [client 127.0.0.1] PHP Fatal error: Class
'MyProject\\ReflectionObject' not found in /var/www/myproject/MyClass.php on
line 6
also namespaces doesn't works with ReflectionClass etc.
but all those scripts work without namespace
Test script:
---------------
//500 Internal Server Error
<?php
namespace MyProject;
class MyClass {
function ff(){
a = new ReflectionObject($this);
echo 'it works';
}
}
$a = new MyClass();
$a->ff();
?>
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=62218&edit=1