diff --git a/lib/blocklib.php b/lib/blocklib.php index 1b3b6f01fad..6d4cb0e713e 100644 --- a/lib/blocklib.php +++ b/lib/blocklib.php @@ -1630,8 +1630,10 @@ class block_manager { if ($bestgap < $newweight) { $newweight = floor($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);