From: Operating system: All PHP version: 5.3.13 Package: Unknown/Other Function Bug Type: Bug Bug description:Fatal error when merging files due to class/function/symbol name collision
Description: ------------ These two namespaces work as expected when in two separate files, and when included together at runtime work as expected as well, but once they're merged in the same file they result in a Fatal Error: namespace Foo { class Bar {} } namespace Foo { use Bar; } Fatal error: Cannot use Bar as Bar because the name is already in use. I understand this behavior was introduced with good intentions, but all it does is break working code when files are merged together. The alternative namespace construct was introduced specifically to support merging of multiple files together without side effects, and this is such a side effect. Expected result: ---------------- I expect that "use" statements should override default resolutions, and no Fatal Error should be produced (the EXACT behavior we have right now when the above is spread in two files which are required() at runtime). Actual result: -------------- Fatal Error when merging code. -- Edit bug report at https://bugs.php.net/bug.php?id=62042&edit=1 -- Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=62042&r=trysnapshot54 Try a snapshot (PHP 5.3): https://bugs.php.net/fix.php?id=62042&r=trysnapshot53 Try a snapshot (trunk): https://bugs.php.net/fix.php?id=62042&r=trysnapshottrunk Fixed in SVN: https://bugs.php.net/fix.php?id=62042&r=fixed Fixed in SVN and need be documented: https://bugs.php.net/fix.php?id=62042&r=needdocs Fixed in release: https://bugs.php.net/fix.php?id=62042&r=alreadyfixed Need backtrace: https://bugs.php.net/fix.php?id=62042&r=needtrace Need Reproduce Script: https://bugs.php.net/fix.php?id=62042&r=needscript Try newer version: https://bugs.php.net/fix.php?id=62042&r=oldversion Not developer issue: https://bugs.php.net/fix.php?id=62042&r=support Expected behavior: https://bugs.php.net/fix.php?id=62042&r=notwrong Not enough info: https://bugs.php.net/fix.php?id=62042&r=notenoughinfo Submitted twice: https://bugs.php.net/fix.php?id=62042&r=submittedtwice register_globals: https://bugs.php.net/fix.php?id=62042&r=globals PHP 4 support discontinued: https://bugs.php.net/fix.php?id=62042&r=php4 Daylight Savings: https://bugs.php.net/fix.php?id=62042&r=dst IIS Stability: https://bugs.php.net/fix.php?id=62042&r=isapi Install GNU Sed: https://bugs.php.net/fix.php?id=62042&r=gnused Floating point limitations: https://bugs.php.net/fix.php?id=62042&r=float No Zend Extensions: https://bugs.php.net/fix.php?id=62042&r=nozend MySQL Configuration Error: https://bugs.php.net/fix.php?id=62042&r=mysqlcfg