<?php
$sysdebug_ignored = forge_get_config('sysdebug_ignored');
+if (!isset($ffErrors))
+ $ffErrors = array();
// error handler function
function ffErrorHandler($errno, $errstr, $errfile, $errline)
/* prepended @ to statement => ignore */
return false;
- if (!isset($ffErrors))
- $ffErrors = array();
-
$msg = "[$errno] $errstr ($errfile at $errline)";
// Display messages only once.
$type = 'unknown';
break;
}
+
+ if (forge_get_config('sysdebug_backtraces))
+ $msg .= "\n" .
+ '<pre style="font-weight:normal; font-size:90%; color:#000066;">' .
+ htmlentities(debug_string_backtrace()) . "</pre>";
$ffErrors[] = array('type' => $type, 'message' => $msg);
/* Don't execute PHP internal error handler */
// this is, sadly, necessary (especially in ff-plugin-mediawiki)
$pre_tag = "<pre style=\"margin:0; padding:0; border:0;\">";
- if (!isset($ffErrors))
- $ffErrors = array();
-
$divstring = "\n\n" . '<script type="text/javascript"><!-- <![CDATA[
function toggle_ffErrors() {
var errorsblock = document.getElementById("ffErrorsBlock");
forge_set_config_item_bool ('sysdebug_enable', 'core') ;
forge_define_config_item ('sysdebug_phphandler', 'core', 'true') ;
forge_set_config_item_bool ('sysdebug_phphandler', 'core') ;
+forge_define_config_item ('sysdebug_backtraces', 'core', 'false') ;
+forge_set_config_item_bool ('sysdebug_backtraces', 'core') ;
forge_define_config_item ('sysdebug_ignored', 'core', 'false') ;
forge_set_config_item_bool ('sysdebug_ignored', 'core') ;
forge_define_config_item ('sysdebug_xmlstarlet', 'core', 'false') ;
}
}
+/* get a backtrace as string */
+function debug_string_backtrace() {
+ ob_start();
+ debug_print_backtrace();
+ $trace = ob_get_contents();
+ ob_end_clean();
+
+ // Remove first item from backtrace as it's this function
+ // which is redundant.
+ $trace = preg_replace('/^#0\s+' . __FUNCTION__ . "[^\n]*\n/", '',
+ $trace, 1);
+
+ // Renumber backtrace items.
+ $trace = preg_replace('/^#(\d+)/me', '\'#\' . ($1 - 1)', $trace);
+
+ return $trace;
+}
+
// Local Variables:
// mode: php
// c-file-style: "bsd"
; enable the PHP Error Handler (default if sysdebug_enable)
sysdebug_phphandler = true
+; show backtraces for those (can be VERY long, esp. in gf-p-mediawiki)
+sysdebug_backtraces = false
; also report (display) ignored errors, e.g. from @call
sysdebug_ignored = false
; enable the PHP Error Handler (default if sysdebug_enable)
sysdebug_phphandler = true
+; show backtraces for those (can be VERY long, esp. in gf-p-mediawiki)
+sysdebug_backtraces = false
; also report (display) ignored errors, e.g. from @call
sysdebug_ignored = false
; enable the PHP Error Handler (default if sysdebug_enable)
sysdebug_phphandler = true
+; show backtraces for those (can be VERY long, esp. in gf-p-mediawiki)
+sysdebug_backtraces = false
; also report (display) ignored errors, e.g. from @call
sysdebug_ignored = false
// enable the PHP Error Handler (default if sysdebug_enable)
$sysdebug_phphandler = true;
+// show backtraces for those (can be VERY long, esp. in gf-p-mediawiki)
+$sysdebug_backtraces = false;
// also report (display) ignored errors, e.g. from @call
$sysdebug_ignored = false;
if (!$tid)
$tid = util_path_info_last_numeric_component();
if (!$tid) {
- sysdebug_off("HTTP/1.0 404 Not Found");
+ header("HTTP/1.0 404 Not Found");
echo "You forgot to pass the tid.\n";
exit;
}
$tinfo = getGroupProjectIdGroupId($tid);
if (!$tinfo) {
- sysdebug_off("HTTP/1.0 404 Not Found");
+ header("HTTP/1.0 404 Not Found");
echo "There is no task with id ".$tid."!\n";
exit;
}
/* It is possible to format a rss feed with cascading style sheet and xsl, but it does not work with
* Firefox version 3.6.6, so I did not make use of it. */
- sysdebug_off('Content-Type: application/rss+xml; charset=utf-8');
+ header('Content-Type: application/rss+xml; charset=utf-8');
print'<?xml version="1.0" encoding="utf-8"?>';
print'<!DOCTYPE rss PUBLIC "-//Netscape Communications//DTD RSS 0.91//EN" "http://my.netscape.com/publish/formats/rss-0.91.dtd">';