Bug #71202 [Opn->Csd]: Autoload function registered by another not activated immediately

[email protected]
Newsgroups php.bugs
Message-ID <[email protected]>
Edit report at https://bugs.php.net/bug.php?id=71202&edit=1

 ID:                 71202
 Updated by:         [email protected]
 Reported by:        web001 at zeroj dot net
 Summary:            Autoload function registered by another not
                     activated immediately
-Status:             Open
+Status:             Closed
 Type:               Bug
 Package:            SPL related
 Operating System:   OS X 10.10.1
 PHP Version:        7.0.1
 Block user comment: N
 Private report:     N

 New Comment:

Automatic comment on behalf of [email protected]
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)


Previous Comments:
------------------------------------------------------------------------
[2015-12-23 13:22:33] 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


------------------------------------------------------------------------



--
Edit this bug report at https://bugs.php.net/bug.php?id=71202&edit=1
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.