From: Operating system: Windows PHP version: 5.3.5 Package: Class/Object related Bug Type: Bug Bug description:Cannot create an object reference from a variable with namespaces.
Description: ------------ When creating a new object reference with variables and namespaces (tested with aliasing namespaces [use namespace as alias] and not [\long\namespace\path]) and it fails in both scenarios. This works without the use of namespaces. This bug seems like an overlooked feature. Test script: --------------- # test.php <?php use Test as T; require "namespace_test.php"; $name = "MyClass"; $obj = new T\$name; ?> # namespace_test.php <?php namespace Test { class MyClass { function __construct() { echo "Testing!"; } } } ?> Expected result: ---------------- Testing! Actual result: -------------- Parse error: syntax error, unexpected T_VARIABLE, expecting T_STRING in test.php on line 5 -- Edit bug report at http://bugs.php.net/bug.php?id=54103&edit=1 -- Try a snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=54103&r=trysnapshot52 Try a snapshot (PHP 5.3): http://bugs.php.net/fix.php?id=54103&r=trysnapshot53 Try a snapshot (trunk): http://bugs.php.net/fix.php?id=54103&r=trysnapshottrunk Fixed in SVN: http://bugs.php.net/fix.php?id=54103&r=fixed Fixed in SVN and need be documented: http://bugs.php.net/fix.php?id=54103&r=needdocs Fixed in release: http://bugs.php.net/fix.php?id=54103&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=54103&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=54103&r=needscript Try newer version: http://bugs.php.net/fix.php?id=54103&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=54103&r=support Expected behavior: http://bugs.php.net/fix.php?id=54103&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=54103&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=54103&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=54103&r=globals PHP 4 support discontinued: http://bugs.php.net/fix.php?id=54103&r=php4 Daylight Savings: http://bugs.php.net/fix.php?id=54103&r=dst IIS Stability: http://bugs.php.net/fix.php?id=54103&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=54103&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=54103&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=54103&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=54103&r=mysqlcfg