BUG Exception handling and email notification mechanism now correctly considers the stacktrace as provided by the exceptionHandler function, instead of attempting to perform a debug_backtrace further down the reporting chain (which ends up generating an unnecessarily nested stacktrace). Debug was cleaned up so that errorHandler and exceptionHandler both act consistently. As a result, the LogErrorEmailFormatter class could be simplified.

This was required to fix a bug in which exceptions would not have a visible stacktrace when handled by the email logger.
This commit is contained in:
Damian Mooyman 2013-01-24 08:37:47 +13:00 committed by Ingo Schommer
parent 9ac3cde00b
commit f5749795a1
2 changed files with 5 additions and 8 deletions

View File

@ -698,13 +698,13 @@ function errorHandler($errno, $errstr, $errfile, $errline) {
case E_ERROR:
case E_CORE_ERROR:
case E_USER_ERROR:
Debug::fatalHandler($errno, $errstr, $errfile, $errline, null);
Debug::fatalHandler($errno, $errstr, $errfile, $errline, debug_backtrace());
break;
case E_WARNING:
case E_CORE_WARNING:
case E_USER_WARNING:
Debug::warningHandler($errno, $errstr, $errfile, $errline, null);
Debug::warningHandler($errno, $errstr, $errfile, $errline, debug_backtrace());
break;
case E_NOTICE:
@ -712,7 +712,7 @@ function errorHandler($errno, $errstr, $errfile, $errline) {
case E_DEPRECATED:
case E_USER_DEPRECATED:
case E_STRICT:
Debug::noticeHandler($errno, $errstr, $errfile, $errline, null);
Debug::noticeHandler($errno, $errstr, $errfile, $errline, debug_backtrace());
break;
}
}

View File

@ -41,11 +41,8 @@ class SS_LogErrorEmailFormatter implements Zend_Log_Formatter_Interface {
$data .= "<p style=\"color: white; background-color: $colour; margin: 0\">"
. "[$errorType] $errstr<br />$errfile:$errline\n<br />\n<br />\n</p>\n";
// Get a backtrace, filtering out debug method calls
$data .= SS_Backtrace::backtrace(true, false, array(
'SS_LogErrorEmailFormatter->format',
'SS_LogEmailWriter->_write'
));
// Render the provided backtrace
$data .= SS_Backtrace::get_rendered_backtrace($errcontext);
// Compile extra data
$blacklist = array('message', 'timestamp', 'priority', 'priorityName');