Merge branch 'MDL-30655-master' of git://github.com/sammarshallou/moodle
authorAparup Banerjee <aparup@moodle.com>
Tue, 13 Dec 2011 05:20:21 +0000 (13:20 +0800)
committerAparup Banerjee <aparup@moodle.com>
Tue, 13 Dec 2011 05:20:21 +0000 (13:20 +0800)
lib/blocklib.php

index d5d1c3b..508b94c 100644 (file)
@@ -1467,8 +1467,10 @@ class block_manager {
         } else {
             $newweight = ceil($newweight);
             for ($weight = $bestgap - 1; $weight >= $newweight; $weight--) {
-                foreach ($usedweights[$weight] as $biid) {
-                    $this->reposition_block($biid, $newregion, $weight + 1);
+                if (array_key_exists($weight, $usedweights)) {
+                    foreach ($usedweights[$weight] as $biid) {
+                        $this->reposition_block($biid, $newregion, $weight + 1);
+                    }
                 }
             }
             $this->reposition_block($block->instance->id, $newregion, $newweight);