Affects Version/s: 2.2.4, 2.3.1, 2.4
[If a tester with php 5.4 can be found, this would be best, but regression testing on <5.4 is also sufficient]
1. For a quiz with attempts, go to Results -> Grades in the navigation.
2. Verify that the graph at the bottom of the page appears.
Affected Branches:MOODLE_22_STABLE, MOODLE_23_STABLE, MOODLE_24_STABLE
Fixed Branches:MOODLE_22_STABLE, MOODLE_23_STABLE
Pull from Repository:
Pull Master Branch:
Pull Master Diff URL:
Matthew Davidson reported in
After some testing, the problem seems to be with the line in reportlib.php, function quiz_report_grade_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"
However, if Moodle would like to be proactive in this, it could be fixed on your end by casting the variable $bands like so...