From 9f13a3b384785321fbfdd0344e95d58c58bc5086 Mon Sep 17 00:00:00 2001 From: Urban Müller Date: Fri, 6 Apr 2012 22:43:56 +0000 Subject: handle errmsg containing latin1 --- it.class | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/it.class b/it.class index fdb9cc2..787d748 100644 --- a/it.class +++ b/it.class @@ -225,7 +225,7 @@ static function error($p = array(), $body = null, $to = null) # $body and $to de $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 = it::replace(array('(pw|passw|password|secret)\] => .*' => '$1] => ********'), $body); + $body = it::replace(array('(pw|passw|password|secret)\] => .*' => '$1] => ********'), $body, array('utf8' => false)); } it::mail(array('To' => $p['to'], 'Subject' => substr($p['title'], 0, 80), 'Body' => $body, 'Cc' => $GLOBALS['it_defaultconfig']['error_cc'], 'forcemail' => !it::is_devel())); @@ -239,12 +239,8 @@ static function error($p = array(), $body = null, $to = null) # $body and $to de if ($_SERVER['REMOTE_ADDR']) error_log("it::error: " . $p['title'] . " Url: $url"); - if (($fh = fopen("/tmp/alertdata/alert.log", "a"))) - { - fputs($fh, it::date() . " " . $p['title'] . " in " . ($trace ? $trace : "{$p['file']}:{$p['line']} Url: $url") . "\n"); - fclose($fh); - @chmod("/tmp/alertdata/alert.log", 0777); - } + file_put_contents("/tmp/alertdata/alert.log", it::date() . " " . $p['title'] . " in " . ($trace ? $trace : "{$p['file']}:{$p['line']} Url: $url") . "\n", FILE_APPEND); + @chmod("/tmp/alertdata/alert.log", 0777); } -- cgit v1.2.3