소스 검색

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

* Prevent "Undefined index" notice #68

* Update Lang.php
Pietro Marangon 5 년 전
부모
커밋
33e8223222
1개의 변경된 파일6개의 추가작업 그리고 2개의 파일을 삭제
  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;
 	}
-}
+}