Bug #61697 [Ana->Asn]: spl_autoload_functions returns lambda functions incorrectly

From: Date: Thu, 19 Apr 2012 23:52:00 +0000
Subject: Bug #61697 [Ana->Asn]: spl_autoload_functions returns lambda functions incorrectly
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-169757@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
 Updated by:         felipe@php.net
 Reported by:        stadli at gmx dot de
 Summary:            spl_autoload_functions returns lambda functions
                     incorrectly
-Status:             Analyzed
+Status:             Assigned
 Type:               Bug
 Package:            SPL related
 PHP Version:        5.4.0
-Assigned To:        
+Assigned To:        colder
 Block user comment: N
 Private report:     N



Previous Comments:
------------------------------------------------------------------------
[2012-04-12 05:21:32] laruence@php.net

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] laruence@php.net

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] laruence@php.net

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


Thread (12 messages)

« previous php.bugs (#169757) next »