Bug #77205 [NEW]: No E_ERROR level output from a recursive autoloading call

From: Date: Mon, 26 Nov 2018 18:00:44 +0000
Subject: Bug #77205 [NEW]: No E_ERROR level output from a recursive autoloading call
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-218138@lists.php.net to get a copy of this message
From: claudio dot luis at aptoide dot com Operating system: Linux (Ubuntu) PHP version: 7.2.12 Package: SPL related Bug Type: Bug Bug description:No E_ERROR level output from a recursive autoloading call 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. -- Edit bug report at https://bugs.php.net/bug.php?id=77205&edit=1 -- Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=77205&r=trysnapshot54 Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=77205&r=trysnapshot55 Try a snapshot (trunk): https://bugs.php.net/fix.php?id=77205&r=trysnapshottrunk Fixed in SVN: https://bugs.php.net/fix.php?id=77205&r=fixed Fixed in release: https://bugs.php.net/fix.php?id=77205&r=alreadyfixed Need backtrace: https://bugs.php.net/fix.php?id=77205&r=needtrace Need Reproduce Script: https://bugs.php.net/fix.php?id=77205&r=needscript Try newer version: https://bugs.php.net/fix.php?id=77205&r=oldversion Not developer issue: https://bugs.php.net/fix.php?id=77205&r=support Expected behavior: https://bugs.php.net/fix.php?id=77205&r=notwrong Not enough info: https://bugs.php.net/fix.php?id=77205&r=notenoughinfo Submitted twice: https://bugs.php.net/fix.php?id=77205&r=submittedtwice register_globals: https://bugs.php.net/fix.php?id=77205&r=globals PHP 4 support discontinued: https://bugs.php.net/fix.php?id=77205&r=php4 Daylight Savings: https://bugs.php.net/fix.php?id=77205&r=dst IIS Stability: https://bugs.php.net/fix.php?id=77205&r=isapi Install GNU Sed: https://bugs.php.net/fix.php?id=77205&r=gnused Floating point limitations: https://bugs.php.net/fix.php?id=77205&r=float No Zend Extensions: https://bugs.php.net/fix.php?id=77205&r=nozend MySQL Configuration Error: https://bugs.php.net/fix.php?id=77205&r=mysqlcfg

« previous php.bugs (#218138) next »