summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: c1b56e6)
raw | patch | inline | side by side (parent: c1b56e6)
author | cajus <cajus@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Wed, 18 May 2005 17:19:10 +0000 (17:19 +0000) | ||
committer | cajus <cajus@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Wed, 18 May 2005 17:19:10 +0000 (17:19 +0000) |
html/main.php | patch | blob | history | |
include/functions.inc | patch | blob | history |
diff --git a/html/main.php b/html/main.php
index cd8cfa3da08fdbebd57bc0a7325de51078273138..02e89d1d6ddc481d079114ddd3edcfe2c5e6a77f 100644 (file)
--- a/html/main.php
+++ b/html/main.php
$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 8f80afb403ecec0bf14b3a58eaea49a506ab8363..ef29c218b52ff802a3ee9379210cf888fa6af945 100644 (file)
--- a/include/functions.inc
+++ b/include/functions.inc
{
global $error_collector;
- $error_collector.= sprintf(_("File %s, line %s: %s"), $errfile, $errline, $errstr)."<br>";
-#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.= "<table width=100% cellspacing=0 style='background-color:#804010;color:white;border:2px solid #F09000'><tr><td colspan=3><b>"._("Error").":</b> $errstr</td></tr>";
+
+ /* Generate trace history */
+ for ($index= 1; $index<count($trace); $index++){
+ $ct= $trace[$index];
+ $loc= "";
+ if (isset($ct['class'])){
+ $loc.= _("class")." ".$ct['class'];
+ if (isset($ct['function'])){
+ $loc.= " / ";
+ }
+ }
+ if (isset($ct['function'])){
+ $loc.= _("function")." ".$ct['function'];
+ }
+ if (isset($ct['type'])){
+ switch ($ct['type']){
+ case "::":
+ $type= _("static");
+ break;
+
+ case "->":
+ $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.= "<tr style='background-color:$color'><td style='padding-left:20px' width=30%>"._("Trace")."[$index]: $loc</td>";
+ $error_collector.= "<td>"._("File").": $file ("._('Line')." $line)</td><td width=10%>"._("Type").": $type</td></tr>";
+ $error_collector.= "<tr style='background-color:$color'><td colspan=3 style='padding-left:20px;'>"._("Arguments").": $args</td></tr>";
+ }
+
+ /* Close error table */
+ $error_collector.= "</table>";
+
+ /* Write to syslog */
gosa_log ("PHP error: $errstr ($errfile, line $errline)");
}