[geeklog-cvs] geeklog: Added a Xdebug-inspired call stack to the error handler...

geeklog-cvs at lists.geeklog.net geeklog-cvs at lists.geeklog.net
Sun Sep 18 10:25:59 EDT 2011


changeset 8406:e596b34806d1
url:  http://project.geeklog.net/cgi-bin/hgwebdir.cgi/geeklog/rev/e596b34806d1
user: Dirk Haun <dirk at haun-online.de>
date: Sun Sep 18 10:05:28 2011 +0200
description:
Added a Xdebug-inspired call stack to the error handler (somewhat related to feature request #0001377)

diffstat:

 public_html/lib-common.php |  16 ++++++++++++++++
 1 files changed, 16 insertions(+), 0 deletions(-)

diffs (26 lines):

diff -r 74a7b0ddd2cf -r e596b34806d1 public_html/lib-common.php
--- a/public_html/lib-common.php	Sun Sep 11 09:25:13 2011 +0200
+++ b/public_html/lib-common.php	Sun Sep 18 10:05:28 2011 +0200
@@ -7024,6 +7024,22 @@
                 ob_end_clean();
                 echo("$errcontext</body></html>");
             } else {
+                $btr = debug_backtrace();
+                if (! empty($btr)) {
+                    echo "<font size='1'><table class='xdebug-error' dir='ltr' border='1' cellspacing='0' cellpadding='1'>\n";
+                    echo "<tr><th align='left' bgcolor='#e9b96e' colspan='5'>Call Stack</th></tr>\n";
+                    echo "<tr><th align='right' bgcolor='#eeeeec'>#</th><th align='left' bgcolor='#eeeeec'>Function</th><th align='left' bgcolor='#eeeeec'>File</th><th align='right' bgcolor='#eeeeec'>Line</th></tr>\n";
+                    $i = 1;
+                    foreach ($btr as $b) {
+                        echo "<tr><td bgcolor='#eeeeec' align='right'>$i</td><td bgcolor='#eeeeec'>{$b['function']}</td><td bgcolor='#eeeeec'>{$b['file']}</td><td bgcolor='#eeeeec' align='right'>{$b['line']}</td></tr>\n";
+                        $i++;
+                        if ($i > 100) {
+                            echo "<tr><td bgcolor='#eeeeec' align='left' colspan='4'>Possible recursion - aborting.</td></tr>\n";
+                            break;
+                        }
+                    }
+                    echo "</table></font>\n";
+                }
                 echo('<pre>');
                 ob_start();
                 var_dump($errcontext);



More information about the geeklog-cvs mailing list