From:             
Operating system: 
PHP version:      5.3.4
Package:          *General Issues
Bug Type:         Feature/Change Request
Bug description:Localised namespace importing within codeblocks

Description:
------------
It would be nice to important an entire namespace into global space, but
only for 

a controlled section of code

Test script:
---------------
/* desktop.php */

<?php



namespace desktop;



class Window{...}

class Icon{...}

class Button{...}



?>



/* index.php */

<?php



require 'desktop.php';



global_function();



{

  use desktop;



  $window1=new Window();

  $window2=new Window();

  $button1=new Button();

}



more_global_functions();



?>

Expected result:
----------------
Whilst in the codeblock the namespace is available as if it were global,
but once 

outside it is no longer globally available. The global namespace should be


unaffected afterwards

Actual result:
--------------
currently namespaces cannot be imported entirely under the justification
that it 

will pollute the global namespace. I believe that if only done for
controlled 

regions of code this can be avoided & code can be more cleanly written

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

Reply via email to