-
Bug
-
Resolution: Fixed
-
Minor
-
2.2.4, 2.3.1, 2.4
-
MOODLE_22_STABLE, MOODLE_23_STABLE, MOODLE_24_STABLE
-
MOODLE_22_STABLE, MOODLE_23_STABLE
-
Matthew Davidson reported in MDL-34164:
After some testing, the problem seems to be with the line in reportlib.php, function quiz_report_grade_bands():
unset($data[$bands]);
There is definitely a PHP 5.4 issue here. I have made a small script to show this issue. I'll submit it to PHP to get this fixed. It has something to do with how $bands or $foo in this case is cast. It starts as a string, then becomes a double, but something is wrong with it because if you cast the variable as anything the unset() statement will work as intended. Event casting it as a double works:
$test = array("5"=>"bar");
$foo = "10.0000"; // gettype($foo) = "string"
$foo /= 2; //Makes $foo = 5 but still gettype($foo) = "double"
echo gettype($foo);
unset($test[$foo]);However, if Moodle would like to be proactive in this, it could be fixed on your end by casting the variable $bands like so...
unset($data[(int) $bands]);
- has a non-specific relationship to
-
MDL-34164 Broken graph displayed on quiz results page
- Closed