|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2018-11-26 18:05 UTC] requinix@php.net
-Status: Open
+Status: Not a bug
[2018-11-26 18:05 UTC] requinix@php.net
[2018-11-26 18:43 UTC] claudio dot luis at aptoide dot com
[2018-11-26 18:49 UTC] nikic@php.net
[2018-11-26 19:00 UTC] spam2 at rhsoft dot net
[2018-11-26 19:21 UTC] claudio dot luis at aptoide dot com
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Fri Oct 24 19:00:01 2025 UTC |
Description: ------------ Whenever a class or interface is autoloaded through the autoload of another class (internally recursive autoload), if such class or interface file is not found in the end (no file loaded/found), no E_ERROR level error is output to the screen (be it console or browser), namely the error reporting a class or interface to not have been found. In other words, in cases such as: class A extends B and class A implements B if neither A and B have been loaded yet, once A is autoloaded, so is B, but if the autoloading of B fails, no error is output and the program execution simply halts silently, while if the autoloading of A fails, then the expected error is shown, such as: "PHP Fatal error: Class 'A' not found in ..." However, if the file containing class A is explicitly loaded beforehand, like so for example: include_once 'A.php'; then the same test results in a visible error, such as: "PHP Fatal error: Interface 'B' not found in ..." Also, while not shown, in all cases the error is still registered internally and can be fetched with error_get_last(). Test script: --------------- //A.php (B.php does not exist) class A implements B { public function doStuff(): void { echo "Hello World!"; } } //------------------------------------------------------------------ //test.php //load class and interface files residing in the same directory spl_autoload_register(function (string $class): void { @include_once __DIR__ . '/' . $class . '.php'; }, true); (new A)->doStuff(); Expected result: ---------------- The following error output to the console or browser: PHP Fatal error: Interface 'B' not found in /test.php on line 6 Actual result: -------------- No error at all is output, but the program execution is halted.