diff options
author | Urban Müller | 2018-09-19 14:46:30 +0200 |
---|---|---|
committer | Urban Müller | 2018-09-19 14:46:30 +0200 |
commit | 8ee4a71bdebcf3e7b3d64e582640f24f81023160 (patch) | |
tree | 0185351ef7242cd4cf464bbead6a7c0412e0cf33 /it.class | |
parent | 6d573b3fc360467ba8f8e8bf7dc4beaebda1249f (diff) | |
download | itools-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.class | 14 |
1 files changed, 7 insertions, 7 deletions
@@ -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; } |