From: simon at stienen dot name Operating system: FreeBSD PHP version: 5.3SVN-2009-07-24 (SVN) PHP Bug Type: Scripting Engine problem Bug description: namespaces with leading \ misbehave
Description: ------------ So much wrong here ... The initial intention was to get back into global namespace using the "namespace X;" syntax. (Why isn't this possible? Neither as namespace; namespace \; ... not even namespace \\;) Curiously, "namespace \" expected the name of a constant. Even more curiously, "namespace \foo" is looking for the constant "foo" in the *current* namespace. If the constant exists, the namespace directive is simply ignored. If it does not, the script dies with a fatal error. Reproduce code: --------------- namespace Foo; const Bar = "Blob"; namespace \Bar; function x() { echo __NAMESPACE__; } x(); Expected result: ---------------- Pretty much everything else than the actual result ... but at least "Bar" or "Blob" Actual result: -------------- Foo -- Edit bug report at http://bugs.php.net/?id=49046&edit=1 -- Try a snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=49046&r=trysnapshot52 Try a snapshot (PHP 5.3): http://bugs.php.net/fix.php?id=49046&r=trysnapshot53 Try a snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=49046&r=trysnapshot60 Fixed in SVN: http://bugs.php.net/fix.php?id=49046&r=fixed Fixed in SVN and need be documented: http://bugs.php.net/fix.php?id=49046&r=needdocs Fixed in release: http://bugs.php.net/fix.php?id=49046&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=49046&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=49046&r=needscript Try newer version: http://bugs.php.net/fix.php?id=49046&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=49046&r=support Expected behavior: http://bugs.php.net/fix.php?id=49046&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=49046&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=49046&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=49046&r=globals PHP 4 support discontinued: http://bugs.php.net/fix.php?id=49046&r=php4 Daylight Savings: http://bugs.php.net/fix.php?id=49046&r=dst IIS Stability: http://bugs.php.net/fix.php?id=49046&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=49046&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=49046&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=49046&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=49046&r=mysqlcfg