From b72e85bf62a7c1f227e4e70b37451a863a0ad136 Mon Sep 17 00:00:00 2001 From: Simon Rettberg Date: Fri, 7 Apr 2017 11:03:54 +0200 Subject: [inc/Util] Improve traceError() output --- inc/util.inc.php | 47 ++++++++++++++++++++++++++++++++--------------- 1 file changed, 32 insertions(+), 15 deletions(-) (limited to 'inc') diff --git a/inc/util.inc.php b/inc/util.inc.php index f5e10ebc..5d1a4563 100644 --- a/inc/util.inc.php +++ b/inc/util.inc.php @@ -21,6 +21,11 @@ class Util exit(1); } Header('HTTP/1.1 500 Internal Server Error'); + if (isset($_SERVER['HTTP_ACCEPT']) && strpos($_SERVER['HTTP_ACCEPT'], 'html') === false ) { + Header('Content-Type: text/plain; charset=utf-8'); + echo 'API ERROR: ', $message, "\n", self::formatBacktracePlain(debug_backtrace()); + exit(0); + } Header('Content-Type: text/html; charset=utf-8'); echo '