MDL-87438 core: Fix multiselect saving with empty choices
This commit is contained in:
+6
-3
@@ -3682,12 +3682,15 @@ class admin_setting_configmultiselect extends admin_setting_configselect {
|
||||
if (!is_array($data)) {
|
||||
return ''; //ignore it
|
||||
}
|
||||
if (!$this->load_choices() or empty($this->choices)) {
|
||||
return '';
|
||||
}
|
||||
|
||||
unset($data['xxxxx']);
|
||||
|
||||
// Only reject when the caller actually supplied a value
|
||||
// and there is no valid choices to validate against.
|
||||
if (!empty($data) && (!$this->load_choices() || empty($this->choices))) {
|
||||
return '';
|
||||
}
|
||||
|
||||
$save = array();
|
||||
foreach ($data as $value) {
|
||||
if (!array_key_exists($value, $this->choices)) {
|
||||
|
||||
Reference in New Issue
Block a user