Fix warning when no header language set

This commit is contained in:
slawkens 2023-05-25 11:39:45 +02:00
parent de710dff94
commit 61c2661377

View File

@ -754,10 +754,10 @@ function get_browser_languages()
{ {
$ret = array(); $ret = array();
$acceptLang = $_SERVER['HTTP_ACCEPT_LANGUAGE']; if(empty($_SERVER['HTTP_ACCEPT_LANGUAGE']))
if(!isset($acceptLang[0]))
return $ret; return $ret;
$acceptLang = $_SERVER['HTTP_ACCEPT_LANGUAGE'];
$languages = strtolower($acceptLang); $languages = strtolower($acceptLang);
// $languages = 'pl,en-us;q=0.7,en;q=0.3 '; // $languages = 'pl,en-us;q=0.7,en;q=0.3 ';
// need to remove spaces from strings to avoid error // need to remove spaces from strings to avoid error