From a3ea846390262ec0c240109a5362da029eab2194 Mon Sep 17 00:00:00 2001 From: veselcraft Date: Sat, 18 Sep 2021 12:34:52 +0300 Subject: [PATCH] Localization: If browser does not send the Accept-Language header the page crashes. Now it's not --- bootstrap.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/bootstrap.php b/bootstrap.php index d7c61d4f..89b03fe1 100644 --- a/bootstrap.php +++ b/bootstrap.php @@ -117,7 +117,8 @@ function isLanguageAvailable($lg): bool function getBrowsersLanguage(): array { - return mb_split(",", mb_split(";", $_SERVER['HTTP_ACCEPT_LANGUAGE'])[0]); + if ($_SERVER['HTTP_ACCEPT_LANGUAGE'] != null) return mb_split(",", mb_split(";", $_SERVER['HTTP_ACCEPT_LANGUAGE'])[0]); + else return array(); } function eventdb(): ?DatabaseConnection