From 3eba0fd72e667b4c2f3362c7cd4db4e989af56eb Mon Sep 17 00:00:00 2001 From: Urban Müller Date: Wed, 3 Apr 2024 15:38:42 +0200 Subject: use json for superglobal output --- it.class | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/it.class b/it.class index 9e5efb7..0351b57 100644 --- a/it.class +++ b/it.class @@ -296,13 +296,13 @@ static function error($p = array(), $extra = null) $body .= ($traceline and $t = it::exec('grep -h {0} `ls 2>/dev/null {1}/log/alertlog-*|tail -3` /dev/null 2>/dev/null | grep ^2 | cut -d : -f 1-2 | sort | uniq -c | tail -10', $traceline, $home)) ? "Histogram: (last 10 affected minutes in 3 days)\n$t\n" : ""; $body .= $mediumstack ? "Stack:\n " . it::replace(["\n" => "\n "], $mediumstack) . "\n" : ""; - $body .= $_GET ? "\$_GET: " . var_export($_GET, true) . "\n\n" : ""; - $body .= $_POST ? "\$_POST: " . var_export($_POST, true) . "\n\n" : ""; - $body .= $reqbody ? "\$reqbody: " . var_export($reqbody, true) . "\n\n" : ""; - $body .= $_COOKIE ? "\$_COOKIE: " . var_export($_COOKIE, true) . "\n\n" : ""; + $body .= $_GET ? "\$_GET: " . it::json_encode($_GET, ['pretty' => true]) . "\n\n" : ""; + $body .= $_POST ? "\$_POST: " . it::json_encode($_POST, ['pretty' => true]) . "\n\n" : ""; + $body .= $reqbody ? "\$reqbody: " . it::json_encode($reqbody, ['pretty' => true]) . "\n\n" : ""; + $body .= $_COOKIE ? "\$_COOKIE: " . it::json_encode($_COOKIE, ['pretty' => true]) . "\n\n" : ""; $body .= $_SERVER['REMOTE_ADDR'] ? "" : "Pstree:\n" . it::exec("pstree -als {pid} | head -n -3", ['pid' => getmypid()]) . "\n"; - $body .= $_SERVER ? "\$_SERVER: " . var_export($_SERVER, true) . "\n\n" : ""; - $body .= $_FILES ? "\$_FILES: " . var_export($_FILES, true) . "\n\n" : ""; + $body .= $_SERVER ? "\$_SERVER: " . it::json_encode($_SERVER, ['pretty' => true]) . "\n\n" : ""; + $body .= $_FILES ? "\$_FILES: " . it::json_encode($_FILES, ['pretty' => true]) . "\n\n" : ""; $body .= "Processes:\n" . it::exec('ps auxf | egrep -v "rotatelogs|getbanner|logaction|httpd|systemd|sd-pam"|egrep "^www|^cron"') . "\n"; $body .= $longstack ? "Full stack: " . "$longstack\n" : ""; $body = it::replace(array('(pw|passw|password\d*|secret)(\' => |\] => |=)[^&\s]*' => '$1$2********'), $body, array('utf8' => false)); -- cgit v1.2.3