|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2017-10-12 23:40 UTC] requinix@php.net
-Status: Open
+Status: Feedback
[2017-10-12 23:40 UTC] requinix@php.net
[2017-10-13 17:45 UTC] tbollinger at ivesinc dot com
-Status: Feedback
+Status: Open
[2017-10-13 17:45 UTC] tbollinger at ivesinc dot com
[2017-10-13 17:46 UTC] tbollinger at ivesinc dot com
-Status: Open
+Status: Closed
[2017-10-13 17:46 UTC] tbollinger at ivesinc dot com
[2017-10-13 20:41 UTC] requinix@php.net
-Status: Closed
+Status: Not a bug
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Tue Oct 28 13:00:01 2025 UTC |
Description: ------------ This bug requires three files to reproduce, since it is an issue with spl_autoload_register(), specifically the prepend argument, and require_once(). Removing the prepend argument displays the expected result. This was created using a base install of PHP 7.1.10. Test script: --------------- ---- file1.php ---- <?php function load() { spl_autoload_register('foo'); } function foo($class) { echo __FUNCTION__ . "\n"; require_once('./file2.php'); } load(); new FooBar(); ---- file2.php ---- <?php function bar($class) { echo __FUNCTION__ . "\n"; require_once('./file3.php'); } spl_autoload_register('bar', true, true); ---- file3.php ---- <?php class FooBar { public function __construct() { echo __CLASS__ . "\n"; } } Expected result: ---------------- foo bar FooBar Actual result: -------------- foo foo PHP Fatal error: Uncaught Error: Class 'FooBar' not found in /home/user/phptest/file1.php:5 Stack trace: #0 {main} thrown in /home/user/phptest/file1.php on line 5