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 <roeland@famdouma.nl>
This commit is contained in:
Roeland Jago Douma 2018-08-08 13:32:03 +02:00
parent bee65f8053
commit c74a5250e5
No known key found for this signature in database
GPG key ID: F941078878347C0C

View file

@ -1535,6 +1535,10 @@ class OC_Util {
* @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;
}