summaryrefslogtreecommitdiff
path: root/it.class
diff options
context:
space:
mode:
authorUrban Müller2018-09-19 14:46:30 +0200
committerUrban Müller2018-09-19 14:46:30 +0200
commit8ee4a71bdebcf3e7b3d64e582640f24f81023160 (patch)
tree0185351ef7242cd4cf464bbead6a7c0412e0cf33 /it.class
parent6d573b3fc360467ba8f8e8bf7dc4beaebda1249f (diff)
downloaditools-8ee4a71bdebcf3e7b3d64e582640f24f81023160.tar.gz
itools-8ee4a71bdebcf3e7b3d64e582640f24f81023160.tar.bz2
itools-8ee4a71bdebcf3e7b3d64e582640f24f81023160.zip
make sure even @it::fatal exits, print "Internal server error" in case of it::fatal and web
Diffstat (limited to 'it.class')
-rw-r--r--it.class14
1 files 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 "<!DOCTYPE html><html><head><title></title></head><body>Internal Server Error</body></html>";
+ }
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;
}