MDL-77735 core: Check $CFG->lang isset
In some cases, $CFG->lang might not be set, and this is causing a Notice to be displayed when, for instance, database connection fails. This patch should fix this case.
This commit is contained in:
+1
-1
@@ -2243,7 +2243,7 @@ function get_html_lang($dir = false) {
|
||||
global $CFG;
|
||||
|
||||
$currentlang = current_language();
|
||||
if ($currentlang !== $CFG->lang && !get_string_manager()->translation_exists($currentlang)) {
|
||||
if (isset($CFG->lang) && $currentlang !== $CFG->lang && !get_string_manager()->translation_exists($currentlang)) {
|
||||
// Use the default site language when the current language is not available.
|
||||
$currentlang = $CFG->lang;
|
||||
// Fix the current language.
|
||||
|
||||
Reference in New Issue
Block a user