From 8ee4a71bdebcf3e7b3d64e582640f24f81023160 Mon Sep 17 00:00:00 2001 From: Urban Müller Date: Wed, 19 Sep 2018 14:46:30 +0200 Subject: make sure even @it::fatal exits, print "Internal server error" in case of it::fatal and web --- it.class | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/it.class b/it.class index 6ce68a8..d62ca1f 100644 --- a/it.class +++ b/it.class @@ -164,7 +164,7 @@ static function error($p = array()) return null; # prevent recursion if (!error_reporting() || $p[0] === false || $p['title'] === false) # called with @ or suppressed - return null; + return $p['fatal'] ? exit(99) : null; if ($_SERVER['REMOTE_ADDR']) $url = "http://" . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']; # we ignore https for easier debugging @@ -239,8 +239,11 @@ static function error($p = array()) } } - if ($p['fatal'] && $_SERVER['REMOTE_ADDR'] && !headers_sent()) - http_response_code(500); + if ($p['fatal'] && $_SERVER['REMOTE_ADDR']) + { + @http_response_code(500); + echo "Internal Server Error"; + } if ($toscreen || $sendmail) { @@ -299,10 +302,7 @@ static function error($p = array()) it::log("/tmp/alertdata/alertlog", $p['title'] . " in " . ($trace ? $trace : "{$p['file']}:{$p['line']}") . " Url: $url" . ($p['body'] ? "\n" . substr(D($p['body']), 0, 5000) . "\n" : "")); - if ($p['fatal']) - exit(99); - - return null; + return $p['fatal'] ? exit(99) : null; } -- cgit v1.2.3