php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #75049 spl_autoload_unregister can't handle spl_autoload_functions results
Submitted: 2017-08-08 15:16 UTC Modified: -
From: maxim dot lavrinenko at maximaster dot ru Assigned:
Status: Closed Package: SPL related
PHP Version: 7.1.8 OS: Windows + Debian w/ php 7.0.8-1
Private report: No CVE-ID: None
View Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
If you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: maxim dot lavrinenko at maximaster dot ru
New email:
PHP Version: OS:

 

 [2017-08-08 15:16 UTC] maxim dot lavrinenko at maximaster dot ru
Description:
------------
spl_autoload_unregister can't handle spl_autoload_functions results when autoloader is static method and register as string with \ prefix

real example:
https://github.com/goaop/framework/blob/master/src/Instrument/ClassLoading/AopComposerLoader.php#L106
buggy when load under Bitrix: https://github.com/matiaspub/bxApiDocs/blob/master/modules/main/lib/loader.php#L462

Test script:
---------------
class Auto { public static function loader() {}}
$autoloader = '\Auto::loader';

echo (int)spl_autoload_register($autoloader);
foreach (spl_autoload_functions() as $loader) {
    echo (int)spl_autoload_unregister($loader);
}
echo (int)count(spl_autoload_functions());

Expected result:
----------------
110

Actual result:
--------------
101

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2017-08-09 03:31 UTC] laruence@php.net
Automatic comment on behalf of laruence@gmail.com
Revision: http://git.php.net/?p=php-src.git;a=commit;h=b06f8cb58bfb7310fff483cb739449e75cd90b79
Log: Fixed bug #75049 (spl_autoload_unregister can't handle spl_autoload_functions results)
 [2017-08-09 03:31 UTC] laruence@php.net
-Status: Open +Status: Closed
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Nov 23 09:01:28 2024 UTC