|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #46226 Create new namespace __autoload-type function
Submitted: 2008-10-03 15:35 UTC Modified: 2018-03-25 16:28 UTC
Avg. Score:3.0 ± 2.0
Reproduced:1 of 1 (100.0%)
Same Version:0 (0.0%)
Same OS:0 (0.0%)
From: phpbugs at sevenlight dot com Assigned:
Status: Suspended Package: *General Issues
PHP Version: 5.3.0alpha2 OS: OSX 10.5.5
Private report: No CVE-ID: None
Have you experienced this issue?
Rate the importance of this bug to you:

 [2008-10-03 15:35 UTC] phpbugs at sevenlight dot com
I suggest adding a new function called __import() or __use() or something similar to autoload namespaces when they are used() but undefined.

Reproduce code:
function __import($sNamespace)
    // sample code to load namespace dynamically
    echo "Auto-Importing $sNamespace\n";
    require_once '/path/to/folder/' . join('/', explode('::', $sNamespace) . '.php';

namespace MyNamespace;
use Library::DB::Connector;
use Library::Other::Stuff;

Expected result:
Auto-Importing Library::DB::Connector
Auto-Importing Library::Other::Stuff


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2018-03-25 16:28 UTC]
-Status: Open +Status: Suspended -Package: Feature/Change Request +Package: *General Issues
 [2018-03-25 16:28 UTC]
This feature would require the RFC process[1].  Anybody is welcome
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: Mon Oct 18 02:03:34 2021 UTC