#46974 [Com]: Closure and Namespaces bug! FATAL ERROR

From: Date: Fri, 02 Jan 2009 01:11:21 +0000
Subject: #46974 [Com]: Closure and Namespaces bug! FATAL ERROR
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-132495@lists.php.net to get a copy of this message
ID: 46974 Comment by: info at netmosfera dot it Reported By: info at netmosfera dot it Status: Assigned Bug Type: Scripting Engine problem Operating System: * PHP Version: 5.3.0alpha3 Assigned To: stas New Comment: 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 Previous Comments: ------------------------------------------------------------------------ [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

« previous php.bugs (#132495) next »