From e1ace26f1114b859b84d2806c86a67f3f6eab79a Mon Sep 17 00:00:00 2001 From: Tim Hunt Date: Wed, 4 Mar 2015 18:47:59 +0000 Subject: [PATCH] MDL-49389 blocklib: avoid notices when moving blocks to the bottom --- lib/blocklib.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/lib/blocklib.php b/lib/blocklib.php index 5d1fb248c74..a44c18567ea 100644 --- a/lib/blocklib.php +++ b/lib/blocklib.php @@ -1599,8 +1599,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);