The custom php error handler cannot capture errors of type E_ERROR, E_CORE_ERROR ... However, php shutdown function is called in case of these types (excluding E_PARSE of course). This makes it the place to log these errors in watchdog.
For D7 there is a project http://drupal.org/project/past which already utilises the shutdown function - you can get some overview about the errors and how they are handled via past here: http://techblog.md-systems.ch/tutorial-howto/2013-06-advanced-php-error-...
| Comment | File | Size | Author |
|---|---|---|---|
| #18 | 2019151-18.patch | 3.66 KB | nikhil_110 |
| #18 | interdiff_3-18.txt | 5.73 KB | nikhil_110 |
| #3 | interdiff.txt | 1.32 KB | alansaviolobo |
| #3 | extend_error_handling-2019151-3.patch | 2.62 KB | alansaviolobo |
Comments
Comment #1
blueminds commentedPlease see the attached patch for proposed solution
Comment #2
berdirSymfony 2.3 has the same feature now, but we're not (yet?) using their error handling.
I think test coverage for this would be useful.
Comment #3
alansaviolobo commentedComment #6
marvil07 commentedI could not find that core is doing this in 8.2.x, so this still seems to be relevant.
The patch still applies correctly, but changing to NW to add tests.
Comment #14
mfbThis would still be nice to have (OOM errors sent to loggers, and error message printed rather than WSOD), but needs some updates - filter_xss_admin() no longer exists, set required _drupal_log_error() keys (@message, @backtrace_string, exception).
Comment #18
nikhil_110 commentedFix Cc error #3