#47472 [Com]: Namespaces importing and usage

From: Date: Thu, 02 Jul 2009 20:46:32 +0000
Subject: #47472 [Com]: Namespaces importing and usage
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-139164@lists.php.net to get a copy of this message
ID: 47472 Comment by: qwerty763jd at php dot org Reported By: belliash at gmail dot com Status: Open Bug Type: Feature/Change Request Operating System: Gentoo Linux PHP Version: 5.3.0beta1 New Comment: Huh, You released 5.3 and even does not check this bug report. You FAIL Previous Comments: ------------------------------------------------------------------------ [2009-02-22 11:07:28] belliash at gmail dot com Description: ------------ It is impossible to import namespace (to both global scope and to any other namespace). It is only possible to alias namespaces... Reproduce code: --------------- /* utils_left.php */ <?php namespace Utils\Left; function whichHand() { echo "I'm using my left hand!"; } ?> /* utils_right.php */ <?php namespace Utils\Right; function whichHand() { echo "I'm using my right hand!"; } ?> /* index.php */ <?php include('./utils_left.php'); include('./utils_right.php'); Utils\Left\whichHand(); // outputs "I'm using my left hand!" Utils\Right\whichHand(); // outputs "I'm using my right hand!" use Utils\Left; whichHand(); // outputs "I'm using my left hand!" use Utils\Right; whichHand(); // outputs "I'm using my right hand!" ?> Expected result: ---------------- I'm using my left hand!I'm using my right hand!I'm using my left hand!I'm using my right hand! Actual result: -------------- I'm using my left hand!I'm using my right hand! Fatal error: Call to undefined function whichHand() in /home/Belliash/HtDocs/test/index.php on line 9 ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=47472&edit=1

« previous php.bugs (#139164) next »