Skip to content

Commit 8b486c7

Browse files
author
Pini
authored
Fixed 'Invalid argument supplied for foreach' exception on MiscScriptArraySerialized
After installation using composer, I got this exception on System > Configuration > Magepal > Checkout: Exception #0 (Exception): Warning: Invalid argument supplied for foreach() in {Magento-Root-Dir}/vendor/magepal/magento2-checkout-success-misc-script/Model/Config/Backend/Serialized/MiscScriptArraySerialized.php on line 23
1 parent f79e186 commit 8b486c7

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

Model/Config/Backend/Serialized/MiscScriptArraySerialized.php

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,11 @@ public function afterLoad()
1818
{
1919
parent::afterLoad();
2020
$values = $this->getValue();
21-
foreach ($values as &$value) {
22-
if (!array_key_exists('is_enabled', $value)) {
23-
$value['is_enabled'] = '';
21+
if(is_array($values)){
22+
foreach ($values as &$value) {
23+
if (!array_key_exists('is_enabled', $value)) {
24+
$value['is_enabled'] = '';
25+
}
2426
}
2527
}
2628

0 commit comments

Comments
 (0)