php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #71202 Autoload function registered by another not activated immediately
Submitted: 2015-12-23 13:22 UTC Modified: -
From: web001 at zeroj dot net Assigned:
Status: Closed Package: SPL related
PHP Version: 7.0.1 OS: OS X 10.10.1
Private report: No CVE-ID: None
 [2015-12-23 13:22 UTC] web001 at zeroj dot net
Description:
------------
See test script. An autoload function was added to autoload queue in another autoload function. But the "child" autoload function was not called after other functions.
It works on 5.5 and 5.6.

Test script:
---------------
<?php
spl_autoload_register(function($name){
    if($name == 'C') {
        spl_autoload_register(function($name){
            if($name == 'C') {
                class C {
                    function __construct(){
                        echo "I'm C.\n";
                    }
                }
            }
        });
    }
});

$c = new C();


Expected result:
----------------
I'm C.

Actual result:
--------------
PHP Fatal error:  Uncaught Error: Class 'C' not found

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2015-12-23 15:48 UTC] laruence@php.net
Automatic comment on behalf of laruence@gmail.com
Revision: http://git.php.net/?p=php-src.git;a=commit;h=e21cb2daeabe459db996407df2113bb47a320937
Log: Fixed bug #71202 (Autoload function registered by another not activated immediately)
 [2015-12-23 15:48 UTC] laruence@php.net
-Status: Open +Status: Closed
 [2016-07-20 11:34 UTC] davey@php.net
Automatic comment on behalf of laruence@gmail.com
Revision: http://git.php.net/?p=php-src.git;a=commit;h=e21cb2daeabe459db996407df2113bb47a320937
Log: Fixed bug #71202 (Autoload function registered by another not activated immediately)
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Tue Mar 19 09:01:30 2024 UTC