Edit report at http://bugs.php.net/bug.php?id=51651&edit=1
ID: 51651 Updated by: tony2...@php.net Reported by: bruno dot p dot reis at gmail dot com Summary: Dynamic class instatiation does not recognize namespaces. -Status: Open +Status: Bogus Type: Bug Package: Scripting Engine problem Operating System: windows vista PHP Version: 5.3.2 New Comment: This is a limitation of namespaces in PHP - they are resolved in compile-time. See http://www.php.net/manual/en/language.namespaces.dynamic.php Previous Comments: ------------------------------------------------------------------------ [2010-04-23 23:12:56] bruno dot p dot reis at gmail dot com Description: ------------ When I use a variable value as a class name, the file namespace is not recognized. Test script: --------------- <?php namespace test; class Test{} new Test; $className = '\test\Test'; new $className; // this works $className = 'Test'; new $className; // this should work either, because this file declares the test namespace, but it does not recognize class Test. Expected result: ---------------- I expect to see no error. Actual result: -------------- Fatal error: Class 'Test' not found in ... ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/bug.php?id=51651&edit=1