Permalink
Browse files

MDL-31782 core_grade: fixed a potential infinite loop

  • Loading branch information...
1 parent 5d6285c commit 52929486488959002ecd9d9c1dc17bfb4373580f @andyjdavis andyjdavis committed Sep 27, 2012
Showing with 3 additions and 2 deletions.
  1. +3 −2 lib/grade/grade_category.php
@@ -913,7 +913,10 @@ public function apply_limit_rules(&$grade_values, $items) {
// We're looking for other grade items with the same grade value but a higher grademax
$i = 1;
while ($originalindex+$i < count($grade_keys)) {
+
$possibleitemid = $grade_keys[$originalindex+$i];
+ $i++;
+
if ($grade_values[$founditemid] != $grade_values[$possibleitemid]) {
// The next grade item has a different grade value. Stop looking.
break;
@@ -930,8 +933,6 @@ public function apply_limit_rules(&$grade_values, $items) {
$founditemid = $possibleitemid;
// Continue searching to see if there is an even higher grademax
}
-
- $i++;
}
// Now drop whatever grade item we have found

0 comments on commit 5292948

Please sign in to comment.