ID: 46974 Updated by: [email protected] Reported By: info at netmosfera dot it -Status: Assigned +Status: Open -Bug Type: Scripting Engine problem +Bug Type: Feature/Change Request Operating System: * PHP Version: 5.3.0alpha3 Assigned To: stas New Comment:
I think you can easily implement it in user-space by using either one autoloader checking class name or using multiple autoloaders and http://www.php.net/manual/en/function.spl-autoload-register.php I'm not sure it is practical to do it in the engine as it would require a lot of search around for autoloaders by the engine. I think it's better done in user-space. Previous Comments: ------------------------------------------------------------------------ [2009-01-02 01:11:21] info at netmosfera dot it hi, thanks for accepting this bug i have one request, is possible to make autoloads for namespaces? is this back compatible? namespace a { function __autoload(){echo "a";} new Pippo(); } namespace b { function __autoload(){echo "b";} new Pippo(); } thank you ------------------------------------------------------------------------ [2008-12-30 17:19:24] info at netmosfera dot it ok, with __autoload in global namespace works if you remove the closure but works too where's the problem? ------------------------------------------------------------------------ [2008-12-30 16:50:06] info at netmosfera dot it uhm... autoload is not called! another suggest: Closure is a special class\type so it must be global in a namespace i have to use public function method(\Closure $x){} instead of public function method(Closure $x){} is it correct? Closure is a special type and final too ------------------------------------------------------------------------ [2008-12-30 16:40:22] info at netmosfera dot it Description: ------------ hi, i noticed there is a bug that causes a FATAL ERROR please read the code thank you for your time Reproduce code: --------------- file index.php: <?php namespace Clsure; spl_autoload_register(function($c){ echo $c = str_replace("\\", "-", $c) . ".php"; require($c); }); // TRY TO UNCOMMENT THIS LINE: // $b=function(){}; $a = new Testing(); ?> file Clsure-Testing.php: <?php namespace Clsure; class Testing{function __construct(){echo "constructor";}} ?> Actual result: -------------- Fatal error: Class 'Clsure\Testing' not found in on line 12 ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=46974&edit=1
