#47472 [Com]: Namespaces importing and usage

[email protected] ("qwerty763jd at php dot org")
Newsgroups php.bugs
Message-ID <[email protected]>
 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
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.