|   | php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login | 
| 
  [2008-12-30 16:40 UTC] 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
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits             | |||||||||||||||||||||||||||
|  Copyright © 2001-2025 The PHP Group All rights reserved. | Last updated: Fri Oct 31 13:00:01 2025 UTC | 
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 toohi, 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