Req #46226 [Opn->Sus]: Create new namespace __autoload-type function

From: Date: Sun, 25 Mar 2018 16:28:05 +0000
Subject: Req #46226 [Opn->Sus]: Create new namespace __autoload-type function
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-214470@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=46226&edit=1 ID: 46226 Updated by: cmb@php.net Reported by: phpbugs at sevenlight dot com Summary: Create new namespace __autoload-type function -Status: Open +Status: Suspended Type: Feature/Change Request -Package: Feature/Change Request +Package: *General Issues Operating System: OSX 10.5.5 PHP Version: 5.3.0alpha2 Block user comment: N Private report: N New Comment: This feature would require the RFC process[1]. Anybody is welcome to start it. For the time being, I'm suspending this ticket. [1] <https://wiki.php.net/rfc/howto> Previous Comments: ------------------------------------------------------------------------ [2008-10-03 15:35:01] phpbugs at sevenlight dot com Description: ------------ I suggest adding a new function called __import() or __use() or something similar to autoload namespaces when they are used() but undefined. Reproduce code: --------------- core.php <?php function __import($sNamespace) { // sample code to load namespace dynamically echo "Auto-Importing $sNamespace\n"; require_once '/path/to/folder/' . join('/', explode('::', $sNamespace) . '.php'; } ?> some_other_file.php <?php namespace MyNamespace; use Library::DB::Connector; use Library::Other::Stuff; ?> Expected result: ---------------- Auto-Importing Library::DB::Connector Auto-Importing Library::Other::Stuff ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=46226&edit=1

« previous php.bugs (#214470) next »