#47472 [NEW]: Namespaces importing and usage
| From: | belliash at gmail dot com | Date: | Sun, 22 Feb 2009 11:07:28 +0000 |
| Subject: | #47472 [NEW]: Namespaces importing and usage | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-134081@lists.php.net to get a copy of this message | ||
From: belliash at gmail dot com
Operating system: Gentoo Linux
PHP version: 5.3.0beta1
PHP Bug Type: Feature/Change Request
Bug description: Namespaces importing and usage
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 bug report at http://bugs.php.net/?id=47472&edit=1
--
Try a CVS snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=47472&r=trysnapshot52
Try a CVS snapshot (PHP 5.3): http://bugs.php.net/fix.php?id=47472&r=trysnapshot53
Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=47472&r=trysnapshot60
Fixed in CVS: http://bugs.php.net/fix.php?id=47472&r=fixedcvs
Fixed in CVS and need be documented: http://bugs.php.net/fix.php?id=47472&r=needdocs
Fixed in release: http://bugs.php.net/fix.php?id=47472&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=47472&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=47472&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=47472&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=47472&r=support
Expected behavior: http://bugs.php.net/fix.php?id=47472&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=47472&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=47472&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=47472&r=globals
PHP 4 support discontinued: http://bugs.php.net/fix.php?id=47472&r=php4
Daylight Savings: http://bugs.php.net/fix.php?id=47472&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=47472&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=47472&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=47472&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=47472&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=47472&r=mysqlcfg