Bug #73323 [Fbk->NoF]: Fatal errors not logged nor output when they occur in autoloaded file
| From: | php-bugs at lists dot php dot net | Date: | Sun, 21 Jun 2020 04:22:09 +0000 |
| Subject: | Bug #73323 [Fbk->NoF]: Fatal errors not logged nor output when they occur in autoloaded file | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-227567@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=73323&edit=1
ID: 73323
Updated by: php-bugs@lists.php.net
Reported by: teo8976 at gmail dot com
Summary: Fatal errors not logged nor output when they occur in
autoloaded file
-Status: Feedback
+Status: No Feedback
Type: Bug
Package: SPL related
Operating System: Linux
PHP Version: 5.6.26
Private report: N
New Comment:
No feedback was provided. The bug is being suspended because
we assume that you are no longer experiencing the problem.
If this is not the case and you are able to provide the
information that was requested earlier, please do so and
change the status of the bug back to "Re-Opened". Thank you.
Previous Comments:
------------------------------------------------------------------------
[2020-06-10 10:27:11] nikic@php.net
I can't reproduce this. Parse error reporting in autoloaded files works as usual. There must be
something more complicated going on with the error handler than the example script indicates.
------------------------------------------------------------------------
[2016-10-14 16:00:29] teo8976 at gmail dot com
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 this bug report at https://bugs.php.net/bug.php?id=73323&edit=1