|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #46974 Closure and Namespaces bug! FATAL ERROR
Submitted: 2008-12-30 16:40 UTC Modified: 2016-01-24 04:22 UTC
From: info at netmosfera dot it Assigned:
Status: No Feedback Package: Scripting Engine problem
PHP Version: 5.3.0alpha3 OS: *
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If this is not your bug, you can add a comment by following this link.
If this is your bug, but you forgot your password, you can retrieve your password here.
Bug Type:
From: info at netmosfera dot it
New email:
PHP Version: OS:


 [2008-12-30 16:40 UTC] info at netmosfera dot it
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:

namespace Clsure;
	echo $c = str_replace("\\", "-", $c) . ".php";
// $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


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2008-12-30 16:50 UTC] 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 17:19 UTC] info at netmosfera dot it
ok, with __autoload in global namespace works

if you remove the closure but works too

where's the problem?
 [2009-01-02 01:11 UTC] 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
 [2009-01-09 18:55 UTC]
I think you can easily implement it in user-space by using either one autoloader checking class name or using multiple autoloaders and

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.
 [2011-04-08 20:48 UTC]
-Package: Feature/Change Request +Package: Scripting Engine problem
 [2016-01-16 13:34 UTC]
-Status: Open +Status: Feedback
 [2016-01-16 13:34 UTC]
The initial code reported as a bug works, and the request for namespaced autoloaders is possible in userland code with no new core functionality needed.

If there is still an issue, please cam you clarify what it is?
 [2016-01-24 04:22 UTC] php-bugs at lists dot php dot net
No feedback was provided. The bug is being suspended because
we assume that you are no longer experiencing the problem.
If this is not the case and you are able to provide the
information that was requested earlier, please do so and
change the status of the bug back to "Re-Opened". Thank you.
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sun Apr 14 17:01:28 2024 UTC