Bug #61697 [PATCH]: spl_autoload_functions returns lambda functions incorrectly

From: Date: Thu, 12 Apr 2012 05:16:05 +0000
Subject: Bug #61697 [PATCH]: spl_autoload_functions returns lambda functions incorrectly
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-169465@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=61697&edit=1

 ID:                 61697
 Patch added by:     laruence@php.net
 Reported by:        stadli at gmx dot de
 Summary:            spl_autoload_functions returns lambda functions
                     incorrectly
 Status:             Open
 Type:               Bug
 Package:            SPL related
 PHP Version:        5.4.0
 Block user comment: N
 Private report:     N

 New Comment:

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


Previous Comments:
------------------------------------------------------------------------
[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


Thread (12 messages)

« previous php.bugs (#169465) next »