Bug #71236 [NEW]: Second call of spl_autoload_register() does nothing if it has no arguments

From: Date: Tue, 29 Dec 2015 12:39:24 +0000
Subject: Bug #71236 [NEW]: Second call of spl_autoload_register() does nothing if it has no arguments
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-198279@lists.php.net to get a copy of this message
From: php at maisqi dot com Operating system: Windows and Linux PHP version: Irrelevant Package: SPL related Bug Type: Bug Bug description:Second call of spl_autoload_register() does nothing if it has no arguments Description: ------------ spl_autoload_register() with no arguments registers spl_autoload(). But if we call spl_autoload_register() with a custom function before, it does nothing. Nothing in the documentation seems to support this behaviour as valid. Tested on PHP 5.5 Linux, 5.6 Win64 and 7.01 Win64. Test script: --------------- <?php echo '<pre>'; /** * Every one of these code blocks must be run in separated. */ // Custom function first; spl_autoload after. spl_autoload_register(function ($class) {}); spl_autoload_register(); print_r(spl_autoload_functions()); // Prints only one entry. /* // Custom function first; spl_autoload after. spl_autoload_register(function ($class) {}); spl_autoload_register('spl_autoload'); print_r(spl_autoload_functions()); // Prints two entries, as expected. // spl_autoload first; custom function after. spl_autoload_register(); spl_autoload_register(function ($class) {}); print_r(spl_autoload_functions()); // Prints two entries, as expected. */ Expected result: ---------------- All blocks should print two entries. Actual result: -------------- All blocks should print two entries, except the first that only prints one. -- Edit bug report at https://bugs.php.net/bug.php?id=71236&edit=1 -- Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=71236&r=trysnapshot54 Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=71236&r=trysnapshot55 Try a snapshot (trunk): https://bugs.php.net/fix.php?id=71236&r=trysnapshottrunk Fixed in SVN: https://bugs.php.net/fix.php?id=71236&r=fixed Fixed in release: https://bugs.php.net/fix.php?id=71236&r=alreadyfixed Need backtrace: https://bugs.php.net/fix.php?id=71236&r=needtrace Need Reproduce Script: https://bugs.php.net/fix.php?id=71236&r=needscript Try newer version: https://bugs.php.net/fix.php?id=71236&r=oldversion Not developer issue: https://bugs.php.net/fix.php?id=71236&r=support Expected behavior: https://bugs.php.net/fix.php?id=71236&r=notwrong Not enough info: https://bugs.php.net/fix.php?id=71236&r=notenoughinfo Submitted twice: https://bugs.php.net/fix.php?id=71236&r=submittedtwice register_globals: https://bugs.php.net/fix.php?id=71236&r=globals PHP 4 support discontinued: https://bugs.php.net/fix.php?id=71236&r=php4 Daylight Savings: https://bugs.php.net/fix.php?id=71236&r=dst IIS Stability: https://bugs.php.net/fix.php?id=71236&r=isapi Install GNU Sed: https://bugs.php.net/fix.php?id=71236&r=gnused Floating point limitations: https://bugs.php.net/fix.php?id=71236&r=float No Zend Extensions: https://bugs.php.net/fix.php?id=71236&r=nozend MySQL Configuration Error: https://bugs.php.net/fix.php?id=71236&r=mysqlcfg

« previous php.bugs (#198279) next »