|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #53600 Localised namespace importing within codeblocks
Submitted: 2010-12-23 16:02 UTC Modified: 2018-09-22 17:16 UTC
Avg. Score:5.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:1 (100.0%)
Same OS:1 (100.0%)
From: ProPuke at gmail dot com Assigned:
Status: Suspended Package: *General Issues
PHP Version: 5.3.4 OS:
Private report: No CVE-ID: None
View Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please — but make sure to vote on the bug!
Your email address:
Solve the problem:
49 - 24 = ?
Subscribe to this entry?

 [2010-12-23 16:02 UTC] ProPuke at gmail dot com
It would be nice to important an entire namespace into global space, but only for 
a controlled section of code

Test script:
/* desktop.php */

namespace desktop;

class Window{...}
class Icon{...}
class Button{...}


/* index.php */

require 'desktop.php';


  use desktop;

  $window1=new Window();
  $window2=new Window();
  $button1=new Button();



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


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2018-09-22 17:16 UTC]
-Status: Open +Status: Suspended
 [2018-09-22 17:16 UTC]
This change requires the RFC process[1].  If you, or anybody else,
is still interested in this feature, feel free to start it.  For
the time being, I'm suspending this ticket.

[1] <>
PHP Copyright © 2001-2021 The PHP Group
All rights reserved.
Last updated: Sat Oct 16 20:03:36 2021 UTC