|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2020-06-10 10:27 UTC] nikic@php.net
-Status: Open
+Status: Feedback
[2020-06-10 10:27 UTC] nikic@php.net
[2020-06-21 04:22 UTC] php-bugs at lists dot php dot net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sat Oct 25 07:00:02 2025 UTC |
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.