Localization: If browser does not send the Accept-Language header the page crashes. Now it's not

This commit is contained in:
veselcraft 2021-09-18 12:34:52 +03:00
parent 9578759f17
commit a3ea846390

View file

@ -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