Skip to content
Snippets Groups Projects
Commit e58860be authored by ale's avatar ale
Browse files

Custom warning handler that dumps stack trace

parent c5e9f739
Branches
No related tags found
No related merge requests found
......@@ -181,6 +181,19 @@ if (array_key_exists('debug_cookie_name', $noblogs_config) &&
define('WP_DEBUG', true);
define('WP_DEBUG_LOG', true);
define('WP_DEBUG_DISPLAY', false);
// Warning handler that dumps stack traces.
class WarningWithStacktrace extends ErrorException {}
set_error_handler(function($severity, $message, $file, $line) {
if ($severity & (E_WARNING | E_NOTICE | E_USER_WARNING | E_USER_NOTICE)) {
$ex = new WarningWithStacktrace($message, 0, $severity, $file, $line);
echo "\n" . $ex . "\n\n";
return true;
} else {
throw new ErrorException($message, 0, $severity, $file, $line);
}
});
} else {
define('WP_DEBUG', false);
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment