ID: 43183 Updated by: [EMAIL PROTECTED] Reported By: [EMAIL PROTECTED] -Status: Open +Status: Assigned Bug Type: Scripting Engine problem Operating System: n/a (linux 2.6, mac os x 10.4) PHP Version: 5.3CVS-2007-11-03 (CVS) -Assigned To: +Assigned To: dmitry
Previous Comments: ------------------------------------------------------------------------ [2007-11-03 17:57:01] [EMAIL PROTECTED] 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 this bug report at http://bugs.php.net/?id=43183&edit=1