From:             
Operating system: Linux
PHP version:      5.3.6
Package:          Class/Object related
Bug Type:         Bug
Bug description:use statement overwrite aliased namespace against using multiple

Description:
------------
In use statement we can use "," to separate aliased namespaces but the
alias only affect to the last one declared use namespace. It'll be logical
to use all declared namespaces in alias and use
classes/constants/closures/etc. from aliased namespace where they exists.

Test script:
---------------
<?



namespace A;

class test1 {}

class test2 {}



namespace B;

class test1 {}



use A, B as Foo;



$test1 = new Foo\test1;

echo get_class($test1). "\n";

$test2 = new Foo\test2;

echo get_class($test2). "\n";

Expected result:
----------------
B\test1

A\test2



Actual result:
--------------
B\test1

PHP Fatal error:  Class 'B\test2' not found in test.php on line 13



-- 
Edit bug report at http://bugs.php.net/bug.php?id=54438&edit=1
-- 
Try a snapshot (PHP 5.2):            
http://bugs.php.net/fix.php?id=54438&r=trysnapshot52
Try a snapshot (PHP 5.3):            
http://bugs.php.net/fix.php?id=54438&r=trysnapshot53
Try a snapshot (trunk):              
http://bugs.php.net/fix.php?id=54438&r=trysnapshottrunk
Fixed in SVN:                        
http://bugs.php.net/fix.php?id=54438&r=fixed
Fixed in SVN and need be documented: 
http://bugs.php.net/fix.php?id=54438&r=needdocs
Fixed in release:                    
http://bugs.php.net/fix.php?id=54438&r=alreadyfixed
Need backtrace:                      
http://bugs.php.net/fix.php?id=54438&r=needtrace
Need Reproduce Script:               
http://bugs.php.net/fix.php?id=54438&r=needscript
Try newer version:                   
http://bugs.php.net/fix.php?id=54438&r=oldversion
Not developer issue:                 
http://bugs.php.net/fix.php?id=54438&r=support
Expected behavior:                   
http://bugs.php.net/fix.php?id=54438&r=notwrong
Not enough info:                     
http://bugs.php.net/fix.php?id=54438&r=notenoughinfo
Submitted twice:                     
http://bugs.php.net/fix.php?id=54438&r=submittedtwice
register_globals:                    
http://bugs.php.net/fix.php?id=54438&r=globals
PHP 4 support discontinued:          http://bugs.php.net/fix.php?id=54438&r=php4
Daylight Savings:                    http://bugs.php.net/fix.php?id=54438&r=dst
IIS Stability:                       
http://bugs.php.net/fix.php?id=54438&r=isapi
Install GNU Sed:                     
http://bugs.php.net/fix.php?id=54438&r=gnused
Floating point limitations:          
http://bugs.php.net/fix.php?id=54438&r=float
No Zend Extensions:                  
http://bugs.php.net/fix.php?id=54438&r=nozend
MySQL Configuration Error:           
http://bugs.php.net/fix.php?id=54438&r=mysqlcfg

Reply via email to