Skip to content

Commit 5b666fd

Browse files
authored
Check if array element exists in config load (#167)
1 parent 57b525a commit 5b666fd

File tree

1 file changed

+7
-1
lines changed
  • app/code/Magento/Config/Model/Config/Structure/Element

1 file changed

+7
-1
lines changed

app/code/Magento/Config/Model/Config/Structure/Element/Iterator.php

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,13 @@ public function setElements(array $elements, $scope)
6060
$this->_scope = $scope;
6161
if (count($elements)) {
6262
$lastElement = end($elements);
63-
$this->_lastId = $lastElement['id'];
63+
if (isset($lastElement['id'])) {
64+
$this->_lastId = $lastElement['id'];
65+
} else {
66+
throw new \InvalidArgumentException(
67+
'Missing id key in config structure element. LastElement: ' . json_encode($lastElement)
68+
);
69+
}
6470
}
6571
}
6672

0 commit comments

Comments
 (0)