summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorsalvis2010-11-25 22:01:34 (GMT)
committer salvis2010-11-25 22:01:34 (GMT)
commitf3d0e3f1a08a8cb04395fdf8beac86a431380fc4 (patch)
treef199c2b704d8d42c2972fca211e9478e7a9ae1d4
parente4f24abfb2635443e71946f79793fe91f7440d59 (diff)
Fix backtrace_error_handler().
-rw-r--r--devel.module33
1 files changed, 10 insertions, 23 deletions
diff --git a/devel.module b/devel.module
index 3c20027..24821f0 100644
--- a/devel.module
+++ b/devel.module
@@ -590,36 +590,23 @@ function backtrace_error_handler($error_level, $message, $filename, $line) {
return;
}
if ($error_level & error_reporting()) {
- // 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[$error_level] .': '. $message .' in '. $filename .' on line '. $line .'.';
+ require_once DRUPAL_ROOT . '/includes/errors.inc';
+ $types = drupal_error_levels();
+ $type = $types[$error_level];
+ $backtrace = debug_backtrace();
+ array_shift($backtrace);
+ $variables = array('%error' => $type[0], '%message' => $message, '%function' => $backtrace[0]['function'] .'()', '%file' => $filename, '%line' => $line);
+ $counter = 0;
if (variable_get('error_level', 1) == 1) {
- $backtrace = debug_backtrace();
foreach ($backtrace as $call) {
- $nicetrace[$call['function']] = $call;
+ $nicetrace[$call['function'] . '<span class="' . $counter++ . '" />'] = $call;
}
+ print t('%error: %message in %function (line %line of %file).', $variables) ." =&gt;\n";
krumo($nicetrace);
}
- watchdog('php', '%message in %file on line %line.', array('%error' => $types[$error_level], '%message' => $message, '%file' => $filename, '%line' => $line), WATCHDOG_ERROR);
+ watchdog('php', '%error: %message in %function (line %line of %file).', $variables, $type[1]);
}
}