mirror of
https://github.com/moodle/moodle.git
synced 2025-01-18 22:08:20 +01:00
The strict type checking was causing trouble. In any case, forcing arrays to
NOT mix integer and string keys is a good workaround.
This commit is contained in:
parent
25290a82c6
commit
fdae5b1314
@ -652,9 +652,7 @@ function choose_from_menu ($options, $name, $selected='', $nothing='choose', $sc
|
||||
if (!empty($options)) {
|
||||
foreach ($options as $value => $label) {
|
||||
$output .= ' <option value="'. $value .'"';
|
||||
// The gettype() calls are there because otherwise a numeric zero key is a match for any string value
|
||||
// As gettype() is possibly expensive, only run the check if the simple equality holds true
|
||||
if ($value == $selected && gettype($value) == gettype($selected)) {
|
||||
if ($value == $selected) {
|
||||
$output .= ' selected="selected"';
|
||||
}
|
||||
if ($label === '') {
|
||||
|
Loading…
x
Reference in New Issue
Block a user