summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorUrban Müller2007-10-09 13:05:15 +0000
committerUrban Müller2007-10-09 13:05:15 +0000
commita1580409d7631233b9da3d8d996d58402a63caf5 (patch)
treea1e4b819212b477d2570619c986ce44a48a7cde5
parentf2942a7f06a8ff3bf2fef846514684c25e67ea9b (diff)
downloaditools-a1580409d7631233b9da3d8d996d58402a63caf5.tar.gz
itools-a1580409d7631233b9da3d8d996d58402a63caf5.tar.bz2
itools-a1580409d7631233b9da3d8d996d58402a63caf5.zip
size limit for locals
-rw-r--r--it.class9
1 files changed, 5 insertions, 4 deletions
diff --git a/it.class b/it.class
index aaae945..314d179 100644
--- a/it.class
+++ b/it.class
@@ -189,16 +189,17 @@ function error($p = array(), $body = null, $to = null) # $body and $to deprecate
if ($sendmail) # we're mailing: send maximum info
{
- $p['title'] .= " (on " . getenv('HOSTNAME') . ")";
- $body .= $p['locals'] ? "Locals: " . print_r($p['locals'], true) . "\n\n" : "";
+ $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);
+ $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" : "";
- $pwentry = posix_getpwuid(posix_getuid());
- mail($p['to'], $p['title'], $body, "From: " . $pwentry['name'] ? $pwentry['name'] : posix_getuid());
+ mail($p['to'], $p['title'], $body);
}
else if ($_SERVER['REMOTE_ADDR']) # in shell mode we rely on error_log below
echo "<pre>{$p['title']}\n$body</pre>";