]> git.mjollnir.org Git - moodle.git/commitdiff
merged fix for MDL-11902, gradebook formula dereferencing problem
authortoyomoyo <toyomoyo>
Fri, 26 Oct 2007 02:30:04 +0000 (02:30 +0000)
committertoyomoyo <toyomoyo>
Fri, 26 Oct 2007 02:30:04 +0000 (02:30 +0000)
lib/grade/grade_item.php

index 4140ad2191a86977bbec67b6dab418b3d6f8bf23..f19414362a0f39a52c4df6b65519c69365a3387d 100644 (file)
@@ -1666,9 +1666,13 @@ class grade_item extends grade_object {
         } else {
             $useditems = array();
         }
-
+        
+        // MDL-11902
+        // unset the value if formula is trying to reference to itself
+        // but array keys does not match itemid
         if (!empty($this->id)) {
-            unset($useditems[$this->id]);
+            $useditems = array_diff($useditems, array($this->id));
+            //unset($useditems[$this->id]);
         }
 
         // prepare formula and init maths library