Bug #73323 [NEW]: Fatal errors not logged nor output when they occur in autoloaded file

From: Date: Fri, 14 Oct 2016 16:00:35 +0000
Subject: Bug #73323 [NEW]: Fatal errors not logged nor output when they occur in autoloaded file
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-204779@lists.php.net to get a copy of this message
From: teo8976 at gmail dot com Operating system: Linux PHP version: 5.6.26 Package: SPL related Bug Type: Bug Bug description:Fatal errors not logged nor output when they occur in autoloaded file Description: ------------ I have all set up so as to output all errors. the display_errors flag is On in the relevant .htaccess file, and error_reporting is set to E_ALL & ~E_NOTICE & ~E_STRICT Just to be clear: whenever there is a PARSE ERROR or a call to a non-existing function, or any other kind of fatal error, anywhere in either the "entry" php file (the one called as a result of the http request) or ANY of the included files included via include(), require(), include_once(), require_once(), in all cases except the one I'll mention later, I usually get the fatal error message in the very output to the browser, and also logged to Apache's error_log file. However, when the exact same kind of non-runtime error (e.g. a trivial syntax error) is in a file that is called via require() by a registered autoload function, registered via spl_autoload_register(), then I get no error message whatsoever and I just get an undebuggable blank page. Additionally, the error is not even logged to Apache's error_log. So I waste days to find a trivial syntax error. Test script: --------------- --- index.php --- ini_set('unserialize_callback_func', 'spl_autoload_call'); spl_autoload_register(array('My_Autoloader', 'autoload'), true); class My_Autoloader { static function autoload($classname) { $filename = //.... computes $filename from $classname require_once($filename); } } $instance = new MyClass(); --- /somewhere/MyClass.php --- class MyClass { lkandlnda ** SYNTAX ERROR HERE ** klsjdbklsj } Expected result: ---------------- Parse error: syntax error, unexpected end of file in /somewhere/MyClass.php on line 3 (or something like that) Actual result: -------------- no output, nothing logged I can't stress this enough: if the exact same parse error is in the main file, or in a file include()d or require()d in any other way than in an autoloader, then the error does show up in the output AND in the logs. -- Edit bug report at https://bugs.php.net/bug.php?id=73323&edit=1 -- Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=73323&r=trysnapshot54 Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=73323&r=trysnapshot55 Try a snapshot (trunk): https://bugs.php.net/fix.php?id=73323&r=trysnapshottrunk Fixed in SVN: https://bugs.php.net/fix.php?id=73323&r=fixed Fixed in release: https://bugs.php.net/fix.php?id=73323&r=alreadyfixed Need backtrace: https://bugs.php.net/fix.php?id=73323&r=needtrace Need Reproduce Script: https://bugs.php.net/fix.php?id=73323&r=needscript Try newer version: https://bugs.php.net/fix.php?id=73323&r=oldversion Not developer issue: https://bugs.php.net/fix.php?id=73323&r=support Expected behavior: https://bugs.php.net/fix.php?id=73323&r=notwrong Not enough info: https://bugs.php.net/fix.php?id=73323&r=notenoughinfo Submitted twice: https://bugs.php.net/fix.php?id=73323&r=submittedtwice register_globals: https://bugs.php.net/fix.php?id=73323&r=globals PHP 4 support discontinued: https://bugs.php.net/fix.php?id=73323&r=php4 Daylight Savings: https://bugs.php.net/fix.php?id=73323&r=dst IIS Stability: https://bugs.php.net/fix.php?id=73323&r=isapi Install GNU Sed: https://bugs.php.net/fix.php?id=73323&r=gnused Floating point limitations: https://bugs.php.net/fix.php?id=73323&r=float No Zend Extensions: https://bugs.php.net/fix.php?id=73323&r=nozend MySQL Configuration Error: https://bugs.php.net/fix.php?id=73323&r=mysqlcfg

« previous php.bugs (#204779) next »