MDL-57209 forms: Notice: Undefined index: options in profile edit page

Skipping a loop iteration if the option group has no options.
This commit is contained in:
Craig R Morton 2016-11-30 13:08:56 +08:00
parent a0352aa95e
commit f6f0cb49aa

View File

@ -376,6 +376,9 @@ class MoodleQuickForm_selectgroups extends HTML_QuickForm_element implements tem
if (is_array($this->_values)) {
foreach ($this->_values as $key => $val) {
foreach ($this->_optGroups as $optGroup) {
if (empty($optGroup['options'])) {
continue;
}
for ($i = 0, $optCount = count($optGroup['options']); $i < $optCount; $i++) {
if ((string)$val == (string)$optGroup['options'][$i]['attr']['value']) {
$value[$key] = $optGroup['options'][$i]['text'];