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

From: Date: Wed, 11 Apr 2012 18:29:18 +0000
Subject: Bug #61697 [NEW]: spl_autoload_functions returns lambda functions incorrectly
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-169453@lists.php.net to get a copy of this message
From:             
Operating system: 
PHP version:      5.4.0
Package:          SPL related
Bug Type:         Bug
Bug description:spl_autoload_functions returns lambda functions incorrectly

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 bug report at https://bugs.php.net/bug.php?id=61697&edit=1
-- 
Try a snapshot (PHP 5.4):            https://bugs.php.net/fix.php?id=61697&r=trysnapshot54
Try a snapshot (PHP 5.3):            https://bugs.php.net/fix.php?id=61697&r=trysnapshot53
Try a snapshot (trunk):              https://bugs.php.net/fix.php?id=61697&r=trysnapshottrunk
Fixed in SVN:                        https://bugs.php.net/fix.php?id=61697&r=fixed
Fixed in SVN and need be documented: https://bugs.php.net/fix.php?id=61697&r=needdocs
Fixed in release:                    https://bugs.php.net/fix.php?id=61697&r=alreadyfixed
Need backtrace:                      https://bugs.php.net/fix.php?id=61697&r=needtrace
Need Reproduce Script:               https://bugs.php.net/fix.php?id=61697&r=needscript
Try newer version:                   https://bugs.php.net/fix.php?id=61697&r=oldversion
Not developer issue:                 https://bugs.php.net/fix.php?id=61697&r=support
Expected behavior:                   https://bugs.php.net/fix.php?id=61697&r=notwrong
Not enough info:                     https://bugs.php.net/fix.php?id=61697&r=notenoughinfo
Submitted twice:                     https://bugs.php.net/fix.php?id=61697&r=submittedtwice
register_globals:                    https://bugs.php.net/fix.php?id=61697&r=globals
PHP 4 support discontinued:          https://bugs.php.net/fix.php?id=61697&r=php4
Daylight Savings:                    https://bugs.php.net/fix.php?id=61697&r=dst
IIS Stability:                       https://bugs.php.net/fix.php?id=61697&r=isapi
Install GNU Sed:                     https://bugs.php.net/fix.php?id=61697&r=gnused
Floating point limitations:          https://bugs.php.net/fix.php?id=61697&r=float
No Zend Extensions:                  https://bugs.php.net/fix.php?id=61697&r=nozend
MySQL Configuration Error:           https://bugs.php.net/fix.php?id=61697&r=mysqlcfg



Thread (12 messages)

« previous php.bugs (#169453) next »