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

Custom warning handler that dumps stack trace

parent f8243b5d
Branches
Tags
1 merge request!209Add the memcached plugin (object caching)
......@@ -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