Skip to content

Commit 0d90f00

Browse files
committed
Return empty array if sections key is empty
The `sections` key may not be set during module installation or upgrade and would result in an undefined index notice.
1 parent 3ab339b commit 0d90f00

File tree

2 files changed

+8
-9
lines changed

2 files changed

+8
-9
lines changed

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -281,6 +281,10 @@ protected function _createEmptyElement(array $pathParts)
281281
public function getFieldPathsByAttribute($attributeName, $attributeValue)
282282
{
283283
$result = [];
284+
if (empty($this->_data['sections'])) {
285+
return $result;
286+
}
287+
284288
foreach ($this->_data['sections'] as $section) {
285289
if (!isset($section['children'])) {
286290
continue;

app/code/Magento/EncryptionKey/Setup/Patch/Data/SodiumChachaPatch.php

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -83,15 +83,10 @@ private function reEncryptSystemConfigurationValues()
8383

8484
$this->scope->setCurrentScope(\Magento\Framework\App\Area::AREA_ADMINHTML);
8585

86-
try {
87-
$paths = $this->structure->getFieldPathsByAttribute(
88-
'backend_model',
89-
\Magento\Config\Model\Config\Backend\Encrypted::class
90-
);
91-
} catch (\Exception $e) {
92-
// This is thrown during initial application installation
93-
return;
94-
}
86+
$paths = $this->structure->getFieldPathsByAttribute(
87+
'backend_model',
88+
\Magento\Config\Model\Config\Backend\Encrypted::class
89+
);
9590

9691
$this->scope->setCurrentScope($currentScope);
9792

0 commit comments

Comments
 (0)