MDL-67049 grading: options are array, ensure json_decode() knows it
By default json_decode() returns object for associative arrays. That was not a problem till now becuause array_key_exists() worked with objects too. But in php74 that emits a warning. So we need to ensure that the information arriving to it is an array, allowing everything to continue working ok.
This commit is contained in:
@@ -386,7 +386,7 @@ class gradingform_rubric_controller extends gradingform_controller {
|
||||
public function get_options() {
|
||||
$options = self::get_default_options();
|
||||
if (!empty($this->definition->options)) {
|
||||
$thisoptions = json_decode($this->definition->options);
|
||||
$thisoptions = json_decode($this->definition->options, true); // Assoc. array is expected.
|
||||
foreach ($thisoptions as $option => $value) {
|
||||
$options[$option] = $value;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user