|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2015-12-29 12:41 UTC] php at maisqi dot com
[2015-12-29 14:15 UTC] laruence@php.net
[2015-12-29 19:59 UTC] php at maisqi dot com
[2015-12-29 20:02 UTC] php at maisqi dot com
[2020-06-09 16:06 UTC] nikic@php.net
-Assigned To:
+Assigned To: nikic
[2020-06-10 07:43 UTC] nikic@php.net
-Status: Assigned
+Status: Closed
[2020-06-10 07:43 UTC] nikic@php.net
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Mon Oct 27 14:00:01 2025 UTC |
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.