summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorUrban Müller2007-10-10 13:39:35 +0000
committerUrban Müller2007-10-10 13:39:35 +0000
commitabd5beaa7b63bbfa1f64e278b0bc1de72ec76c4f (patch)
treefa04c273fa47d7d76af9abad8c7db74de196cdf7
parent1cde1b5afbacd882c2bc0ab2904825b9056c1a3d (diff)
downloaditools-abd5beaa7b63bbfa1f64e278b0bc1de72ec76c4f.tar.gz
itools-abd5beaa7b63bbfa1f64e278b0bc1de72ec76c4f.tar.bz2
itools-abd5beaa7b63bbfa1f64e278b0bc1de72ec76c4f.zip
limit backtrace size, kill "aslive" support
-rw-r--r--it.class9
1 files changed, 7 insertions, 2 deletions
diff --git a/it.class b/it.class
index f39b1dd..5e23e55 100644
--- a/it.class
+++ b/it.class
@@ -150,7 +150,7 @@ function error($p = array(), $body = null, $to = null) # $body and $to deprecate
'blockmail' => 3600,
);
- $toscreen = (ini_get('display_errors') || EDC('astwin') || EDC('asdevel')) && !EDC('aslive');
+ $toscreen = ini_get('display_errors') || EDC('astwin') || EDC('asdevel');
if (!$toscreen) # this error can only be sent by mail: find out if we want to suppress it
{
@mkdir("/tmp/alertdata");
@@ -192,13 +192,18 @@ function error($p = array(), $body = null, $to = null) # $body and $to deprecate
$p['title'] = "Alert: " . $p['title'] . " (on " . getenv('HOSTNAME') . ")";
unset ($p['locals']['GLOBALS'], $p['locals']['_GET'], $p['locals']['_POST'], $p['locals']['_COOKIE']);
$locals = print_r($p['locals'], true);
+
+ if ($trace && ($fulltrace = array_slice(debug_backtrace(), $p['backtraceskip'])))
+ while (strlen(print_r($fulltrace, true)) > 100000)
+ array_pop($fulltrace);
+
$body .= "Host: " . getenv('HOSTNAME') . "\n\n";
$body .= $p['locals'] && strlen($locals) < 100000 ? "Locals: $locals\n\n" : "";
$body .= $_GET ? "\$_GET: " . print_r($_GET, true) . "\n\n" : "";
$body .= $_POST ? "\$_POST: " . print_r($_POST, true) . "\n\n" : "";
$body .= $_COOKIE ? "\$_COOKIE: " . print_r($_COOKIE, true) . "\n\n" : "";
$body .= $_SERVER ? "\$_SERVER: " . print_r($_SERVER, true) . "\n\n" : "";
- $body .= $trace ? "Stack: " . print_r(debug_backtrace(), true) . "\n\n" : "";
+ $body .= $fulltrace ? "Stack: " . print_r($fulltrace, true) . "\n\n" : "";
mail($p['to'], $p['title'], $body);
}