|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #53160 Importing and Legacy Mode suggestion for PHP 6.0 (7.0?)
Submitted: 2010-10-25 22:52 UTC Modified: 2018-07-08 14:28 UTC
Avg. Score:3.2 ± 1.5
Reproduced:2 of 2 (100.0%)
Same Version:0 (0.0%)
Same OS:0 (0.0%)
From: dmgx dot michael at gmail dot com Assigned:
Status: Suspended Package: Class/Object related
PHP Version: Irrelevant OS:
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
Block user comment
Status: Assign to:
Bug Type:
From: dmgx dot michael at gmail dot com
New email:
PHP Version: OS:


 [2010-10-25 22:52 UTC] dmgx dot michael at gmail dot com
Currently the internal PHP function library is, well, unique.  Proposed is a 
means to maintain backward compatibility while rectifying the problem and 
hopefully on the engine side speed up the process by reducing what the zend 
engine has to track.

import keyword.
import attaches the specified namespace to the current one. An error is thrown 
if there is a symbol collision between the namespaces.

namespace Bar {
   function Foo(){}
namespace Test {
  import \Bar
  Foo() // works
  Bar\Foo() // doesn't work - try use Bar instead.

If import is asked to pull a namespace that doesn't exist there's an error. 
Import has one other use.

namespace Test;
import @PDO;

This pulls the PDO library of PHP 6 into the Test namespace. This brings us back 
to the solution of the function library problem.

PHP 6 would ship with a legacy mode set to true. In that mode everything is as 
now - the namespace \ having thousands of functions.

Turn it off though and namespace \ is empty except for a core selection of 
functions and objects. The rest of the function library will be divided into 
libraries that can be imported as needed.

Legacy functions remain available in library legacy so

namespace MyNamespace;
import @Legacy;

would let code in MyNamespace use the current function library.


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2010-10-26 01:56 UTC]
-Type: Bug +Type: Feature/Change Request
 [2018-07-08 14:28 UTC]
-Status: Open +Status: Suspended
 [2018-07-08 14:28 UTC]
This is certainly a feature request which requires discussion on
the internals@ mailing list, and likely the RFC process.  For the
time being, I'm suspending this ticket.
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Jun 20 15:01:32 2024 UTC