diff options
-rw-r--r-- | it.class | 11 |
1 files changed, 4 insertions, 7 deletions
@@ -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)); } |