summaryrefslogtreecommitdiff
path: root/it.class
diff options
context:
space:
mode:
authorUrban Müller2012-10-16 14:51:53 +0000
committerUrban Müller2012-10-16 14:51:53 +0000
commitd2e3af498517d0e459be3b0c66d9c1cad0c6c25a (patch)
treedc996538fe735bb5c4e62c189c29a51694feb815 /it.class
parente1828e884f7c5475eea92ec13191ebd9c20ede92 (diff)
downloaditools-d2e3af498517d0e459be3b0c66d9c1cad0c6c25a.tar.gz
itools-d2e3af498517d0e459be3b0c66d9c1cad0c6c25a.tar.bz2
itools-d2e3af498517d0e459be3b0c66d9c1cad0c6c25a.zip
conserve mem in it::error
Diffstat (limited to 'it.class')
-rw-r--r--it.class11
1 files changed, 4 insertions, 7 deletions
diff --git a/it.class b/it.class
index f3ef89a..12a35a4 100644
--- a/it.class
+++ b/it.class
@@ -206,21 +206,18 @@ static function error($p = array(), $body = null, $to = null) # $body and $to de
if (!$p['omitdebuginfo'])
{
- $locals = print_r(array_diff_key((array)$p['locals'], array("GLOBALS", "_GET", "_POST", "_COOKIE")), true);
-
- if ($trace && ($fulltrace = array_slice(debug_backtrace(), $p['backtraceskip'])))
- while (strlen(print_r($fulltrace, true)) > 100000)
- array_pop($fulltrace);
+ foreach (($trace ? debug_backtrace() : array()) as $level => $stackframe)
+ if ($level >= $p['backtraceskip'] && $tracesize < 100000 && ($tracesize += strlen(print_r($stackframe, true))) < 100000) # save mem
+ $stackframes[] = $stackframe;
$body .= "Host: " . getenv('HOSTNAME') . "\n\n";
- $body .= $locals && strlen($locals) < 100000 ? "Locals: $locals\n\n" : "";
$body .= $p['id'] ? "Filter: graceperiod={$p['graceperiod']} timewindow={$p['timewindow']}\n\n" : "";
$body .= "Time: " . it::date() . "\n\n";
$body .= $_GET ? "\$_GET: " . var_export($_GET, true) . "\n\n" : "";
$body .= $_POST ? "\$_POST: " . var_export($_POST, true) . "\n\n" : "";
$body .= $_COOKIE ? "\$_COOKIE: " . var_export($_COOKIE, true) . "\n\n" : "";
$body .= $_SERVER ? "\$_SERVER: " . var_export($_SERVER, true) . "\n\n" : "";
- $body .= $fulltrace ? "Stack: " . print_r($fulltrace, true) . "\n\n" : "";
+ $body .= $stackframes ? "Stack: " . print_r($stackframes, true) . "\n\n" : "";
$body = it::replace(array('(pw|passw|password|secret)\] => .*' => '$1] => ********'), $body, array('utf8' => false));
}