From c415a9374872c6235fe822a5e038546522817e3a Mon Sep 17 00:00:00 2001 From: Simon Rettberg Date: Tue, 21 Mar 2017 12:18:47 +0100 Subject: Fix a couple of warnings and notices from error.log --- inc/util.inc.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'inc/util.inc.php') diff --git a/inc/util.inc.php b/inc/util.inc.php index d454d18d..f5e10ebc 100644 --- a/inc/util.inc.php +++ b/inc/util.inc.php @@ -375,7 +375,7 @@ SADFACE; * @param bool $secure true = only use strong random sources * @return string|bool string of requested length, false on error */ - public static function randomBytes($length, $secure) + public static function randomBytes($length, $secure = true) { if (function_exists('random_bytes')) { return random_bytes($length); -- cgit v1.2.3-55-g7522 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/util.inc.php') 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 '