From c74a5250e5b2a34ee8e070cfc6ee7fac8c06891b Mon Sep 17 00:00:00 2001 From: Roeland Jago Douma Date: Wed, 8 Aug 2018 13:32:03 +0200 Subject: [PATCH] Check if HTTP_USER_AGENT is set before using it Sentry reported some errors regarding this. Apparently not everybody sets a user agent. If it is not set we assume this is not IE ;) Signed-off-by: Roeland Jago Douma --- lib/private/legacy/util.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lib/private/legacy/util.php b/lib/private/legacy/util.php index a581397212afe..1b9f52008fd6b 100644 --- a/lib/private/legacy/util.php +++ b/lib/private/legacy/util.php @@ -1535,6 +1535,10 @@ public static function needUpgrade(\OC\SystemConfig $config) { * @return boolean */ public static function isIe() { + if (!isset($_SERVER['HTTP_USER_AGENT'])) { + return false; + } + return preg_match(Request::USER_AGENT_IE, $_SERVER['HTTP_USER_AGENT']) === 1; }