diff options
author | Urban Müller | 2007-10-10 13:39:35 +0000 |
---|---|---|
committer | Urban Müller | 2007-10-10 13:39:35 +0000 |
commit | abd5beaa7b63bbfa1f64e278b0bc1de72ec76c4f (patch) | |
tree | fa04c273fa47d7d76af9abad8c7db74de196cdf7 /it.class | |
parent | 1cde1b5afbacd882c2bc0ab2904825b9056c1a3d (diff) | |
download | itools-abd5beaa7b63bbfa1f64e278b0bc1de72ec76c4f.tar.gz itools-abd5beaa7b63bbfa1f64e278b0bc1de72ec76c4f.tar.bz2 itools-abd5beaa7b63bbfa1f64e278b0bc1de72ec76c4f.zip |
limit backtrace size, kill "aslive" support
Diffstat (limited to 'it.class')
-rw-r--r-- | it.class | 9 |
1 files changed, 7 insertions, 2 deletions
@@ -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); } |