From 8e52fe2d3f46f21f64a4fd766b1f8f403a3e57df Mon Sep 17 00:00:00 2001 From: Key Shang Date: Mon, 12 Aug 2019 16:13:59 +0800 Subject: [PATCH] Fix list function exception - Undefined offset When location doesn't set, $value is empty string '', which result in list function exception - Undefined offset. --- Observer/AddBlock.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Observer/AddBlock.php b/Observer/AddBlock.php index 692fc1a..f5fd167 100644 --- a/Observer/AddBlock.php +++ b/Observer/AddBlock.php @@ -87,6 +87,9 @@ public function execute(Observer $observer) foreach ($this->helperData->getActiveSliders() as $slider) { $locations = explode(',', $slider->getLocation()); foreach ($locations as $value) { + if(!$value) { + continue;//when location doesn't set, $value is '' + } list($pageType, $location) = explode('.', $value); if (($fullActionName === $pageType || $pageType === 'allpage') && strpos($location, $type) !== false