From 1bdd8664f9dd3d8225df89ba87af995cf316e997 Mon Sep 17 00:00:00 2001 From: Robert Sesek Date: Sun, 11 Sep 2005 19:48:00 +0000 Subject: [PATCH] Added backtrace --- includes/imaginary.php | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/includes/imaginary.php b/includes/imaginary.php index 423fc7e..08d7001 100644 --- a/includes/imaginary.php +++ b/includes/imaginary.php @@ -46,6 +46,32 @@ class Imaginary */ function error($error) { + global $viewsvn; + + // adapted from PEAR/PHP_Compat + if ($viewsvn->debug) + { + $backtrace = debug_backtrace(); + + $calls = array(); + for ($i = 1; $i < count($backtrace); $i++) + { + $call = $backtrace["$i"]; + + $function = (isset($call['class'])) ? $call['class'] . '.' . $call['function'] : $call['function']; + + $params = ''; + if (isset($call['args'])) + { + $params = implode(', ', $call['args']); + } + + $calls[] = sprintf('#%d : %s(%s) [%s:%s]', $i, $function, $params, $call['file'], $call['line']); + } + + echo implode('
', $calls) . '
'; + } + trigger_error($error, E_USER_ERROR); } } -- 2.43.5