From 34bce1b938f7a92378c713406ba8af2d01311425 Mon Sep 17 00:00:00 2001 From: cajus Date: Wed, 18 May 2005 17:19:10 +0000 Subject: [PATCH] Modified error handler to display error traces git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@248 594d385d-05f5-0310-b6e9-bd551577e9d8 --- html/main.php | 3 --- include/functions.inc | 56 +++++++++++++++++++++++++++++++++++++++++-- 2 files changed, 54 insertions(+), 5 deletions(-) diff --git a/html/main.php b/html/main.php index cd8cfa3da..02e89d1d6 100644 --- a/html/main.php +++ b/html/main.php @@ -83,9 +83,6 @@ setlocale(LC_ALL, $lang); $GLOBALS['t_language']= $lang; $GLOBALS['t_gettext_message_dir'] = $BASE_DIR.'/locale/'; -/* Dummy */ -trigger_error("I'm a fake error. Please ignore me.", E_USER_NOTICE); - /* Set the text domain as 'messages' */ $domain = 'messages'; bindtextdomain($domain, "$BASE_DIR/locale"); diff --git a/include/functions.inc b/include/functions.inc index 8f80afb40..ef29c218b 100644 --- a/include/functions.inc +++ b/include/functions.inc @@ -1513,8 +1513,60 @@ function gosaRaiseError($errno, $errstr, $errfile, $errline) { global $error_collector; - $error_collector.= sprintf(_("File %s, line %s: %s"), $errfile, $errline, $errstr)."
"; -#debug_backtrace(); + /* FIXME: workaround for buggy imap_open */ + if (preg_match('/imap_open/', $errstr)){ + return; + } + + /* Extract traceback data */ + $trace= debug_backtrace(); + + /* Create error header */ + $error_collector.= ""; + + /* Generate trace history */ + for ($index= 1; $index": + $type= _("method"); + break; + } + } else { + $type= "-"; + } + $args= ""; + foreach ($ct['args'] as $arg){ + $args.= "\"$arg\", "; + } + $args= preg_replace("/, $/", "", $args); + $file= $ct['file']; + $line= $ct['line']; + $color= ($index&1)?'#905020':'703000'; + $error_collector.= ""; + $error_collector.= ""; + $error_collector.= ""; + } + + /* Close error table */ + $error_collector.= "
"._("Error").": $errstr
"._("Trace")."[$index]: $loc"._("File").": $file ("._('Line')." $line)"._("Type").": $type
"._("Arguments").": $args
"; + + /* Write to syslog */ gosa_log ("PHP error: $errstr ($errfile, line $errline)"); } -- 2.30.2