function backtrace_error_handler in Devel 5
Same name and namespace in other branches
- 8.3 devel.module \backtrace_error_handler()
- 8 devel.module \backtrace_error_handler()
- 8.2 devel.module \backtrace_error_handler()
- 6 devel.module \backtrace_error_handler()
- 7 devel.module \backtrace_error_handler()
- 4.x devel.module \backtrace_error_handler()
1 string reference to 'backtrace_error_handler'
- devel_init in ./
devel.module - Implementation of hook_init(). Avoids custom error handling for better behavior when stepping though in a debugger.
File
- ./
devel.module, line 297
Code
function backtrace_error_handler($errno, $message, $filename, $line) {
// Don't respond to the error if it was suppressed with a '@'
if (error_reporting() == 0) {
return;
}
if ($errno & (E_ALL ^ E_NOTICE)) {
// We can't use the PHP E_* constants here as not all versions of PHP have all
// the constants defined, so for consistency, we just use the numeric equivelant.
$types = array(
1 => 'error',
2 => 'warning',
4 => 'parse error',
8 => 'notice',
16 => 'core error',
32 => 'core warning',
64 => 'compile error',
128 => 'compile warning',
256 => 'user error',
512 => 'user warning',
1024 => 'user notice',
2048 => 'strict warning',
4096 => 'recoverable error',
8192 => 'deprecated',
16384 => 'user deprecated',
);
$entry = $types[$errno] . ': ' . $message . ' in ' . $filename . ' on line ' . $line . '.';
if (variable_get('error_level', 1) == 1) {
$backtrace = debug_backtrace();
foreach ($backtrace as $call) {
$nicetrace[$call['function']] = $call;
}
krumo($nicetrace);
}
watchdog('php', t('%message in %file on line %line.', array(
'%error' => $types[$errno],
'%message' => $message,
'%file' => $filename,
'%line' => $line,
)), WATCHDOG_ERROR);
}
}