Edit report at https://bugs.php.net/bug.php?id=61697&edit=1
ID: 61697
Comment by: stadli at gmx dot de
Reported by: stadli at gmx dot de
Summary: spl_autoload_functions returns lambda functions
incorrectly
Status: Assigned
Type: Bug
Package: SPL related
PHP Version: 5.4.0
Assigned To: colder
Block user comment: N
Private report: N
New Comment:
Is there a reason, why this fix still hasn't been implemented?
I'd like to see this bug fixed in PHP 5.5
Previous Comments:
------------------------------------------------------------------------
[2012-04-12 05:21:32] [email protected]
I have made a patch for this, but there is a BC break, that is,
spl_autoload_functions return lambad_function with name "__lambad_function"
previously.
after patched, it will return string like "lambad_1".
------------------------------------------------------------------------
[2012-04-12 05:19:39] [email protected]
The following patch has been added/updated:
Patch Name: bug61697.phpt
Revision: 1334207979
URL:
https://bugs.php.net/patch-display.php?bug=61697&patch=bug61697.phpt&revision=1334207979
------------------------------------------------------------------------
[2012-04-12 05:16:05] [email protected]
The following patch has been added/updated:
Patch Name: bug61697.patch
Revision: 1334207765
URL:
https://bugs.php.net/patch-display.php?bug=61697&patch=bug61697.patch&revision=1334207765
------------------------------------------------------------------------
[2012-04-11 18:29:18] stadli at gmx dot de
Description:
------------
spl_autoload_functions() doesn't return the names of lambda-functions
registered with spl_autoload_register() correctly. Actually it always returns
'__lambda_func' for every lambda function so you can't use the result with
spl_autoload_unregister() for example.
Test script:
---------------
<?php
function f1($class) { echo "f1: [[$class]]\n"; }
function f2($class) { echo "f2: [[$class]]\n"; }
spl_autoload_register('f1');
spl_autoload_register('f2');
spl_autoload_register(create_function('$class', 'echo "cf1: [[$class]]\n";'));
spl_autoload_register(create_function('$class', 'echo "cf2: [[$class]]\n";'));
var_dump(spl_autoload_functions());
foreach (spl_autoload_functions() AS $func)
{
spl_autoload_unregister($func);
}
var_dump(spl_autoload_functions());
?>
Expected result:
----------------
All autoload functions are unregistered
Actual result:
--------------
lambda functions aren't unregistered
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=61697&edit=1