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:
Sara Arjona
2023-04-14 13:46:45 +02:00
parent 9cae11732f
commit 18886c271f
+1 -1
View File
@@ -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.