Browse Source

Prevent "Undefined index" notice #68 (#69)

* Prevent "Undefined index" notice #68

* Update Lang.php
Pietro Marangon 5 years ago
parent
commit
33e8223222
1 changed files with 6 additions and 2 deletions
  1. 6 2
      app/Web/Lang.php

+ 6 - 2
app/Web/Lang.php

@@ -58,7 +58,11 @@ class Lang
 	 */
 	public static function recognize()
 	{
-		return locale_accept_from_http($_SERVER['HTTP_ACCEPT_LANGUAGE']);
+		if (isset($_SERVER['HTTP_ACCEPT_LANGUAGE'])) {
+			return locale_accept_from_http($_SERVER['HTTP_ACCEPT_LANGUAGE']);
+		} else {
+			return self::DEFAULT_LANG;
+		}
 	}
 
 	/**
@@ -133,4 +137,4 @@ class Lang
 
 		return $key;
 	}
-}
+}