MDL-69772 lang: Ignore misconfigured allcountrycodes filter

If the allcountrycodes filter contains only invalid values, ignore the
whole filter setting and make get_list_of_countries() return the full
list of all known countries, rather than empty list.
This commit is contained in:
David Mudrák
2020-09-24 18:14:29 +02:00
parent ab5d361c80
commit 56adf1f3d8
2 changed files with 56 additions and 1 deletions
+5 -1
View File
@@ -427,6 +427,7 @@ class core_string_manager_standard implements core_string_manager {
$countries = $this->load_component_strings('core_countries', $lang);
core_collator::asort($countries);
if (!$returnall and !empty($CFG->allcountrycodes)) {
$enabled = explode(',', $CFG->allcountrycodes);
$return = array();
@@ -435,7 +436,10 @@ class core_string_manager_standard implements core_string_manager {
$return[$c] = $countries[$c];
}
}
return $return;
if (!empty($return)) {
return $return;
}
}
return $countries;