From: [EMAIL PROTECTED] Operating system: n/a (linux 2.6, mac os x 10.4) PHP version: 5.3CVS-2007-11-03 (CVS) PHP Bug Type: Scripting Engine problem Bug description: importing the same class in difference scripts results in a fatal error
Description: ------------ As per discussion on the PHP internals list, the proper way to ensure that when using a short name, the class loaded is always from the current namespace (even if it needs to be autoloaded and has not yet been loaded) is to import that class in every file where it is used. However, doing so in two separate scripts, OR just importing a class that has already been defined in the namespace, can result in a fatal error claiming an import clash. Because of the nature of namespaces and this bug it requires 2 small scripts to reproduce, not one. Reproduce code: --------------- ns_import1.php: --------------- <?php namespace Test; class Helper {} include dirname(__FILE__) . '/ns_import2.php'; ns_import2.php: --------------- <?php namespace Test; import Test::Helper; class Other {} Expected result: ---------------- No error, should be no output. Actual result: -------------- $ php ns_import1.php Fatal error: Import name 'Helper' conflicts with defined class in /tmp/ns_import2.php on line 5 -- Edit bug report at http://bugs.php.net/?id=43183&edit=1 -- Try a CVS snapshot (PHP 4.4): http://bugs.php.net/fix.php?id=43183&r=trysnapshot44 Try a CVS snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=43183&r=trysnapshot52 Try a CVS snapshot (PHP 5.3): http://bugs.php.net/fix.php?id=43183&r=trysnapshot53 Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=43183&r=trysnapshot60 Fixed in CVS: http://bugs.php.net/fix.php?id=43183&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=43183&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=43183&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=43183&r=needscript Try newer version: http://bugs.php.net/fix.php?id=43183&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=43183&r=support Expected behavior: http://bugs.php.net/fix.php?id=43183&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=43183&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=43183&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=43183&r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=43183&r=php3 Daylight Savings: http://bugs.php.net/fix.php?id=43183&r=dst IIS Stability: http://bugs.php.net/fix.php?id=43183&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=43183&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=43183&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=43183&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=43183&r=mysqlcfg