From a1580409d7631233b9da3d8d996d58402a63caf5 Mon Sep 17 00:00:00 2001 From: Urban Müller Date: Tue, 9 Oct 2007 13:05:15 +0000 Subject: size limit for locals --- it.class | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'it.class') 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 "
{$p['title']}\n$body"; -- cgit v1.2.3