From abd5beaa7b63bbfa1f64e278b0bc1de72ec76c4f Mon Sep 17 00:00:00 2001 From: Urban Müller Date: Wed, 10 Oct 2007 13:39:35 +0000 Subject: limit backtrace size, kill "aslive" support --- it.class | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'it.class') 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); } -- cgit v1.2.3