Skip to content

Commit 0cfd14e

Browse files
authored
Enforce array type in DesignTheme config processor
Without this, an empty config node like `<my_store />` in a `config.xml` breaks installation, as `null` is passed to the private method. Since it is private this change is 100% backwards compatible. I'm not adding a test case since not having regressions should be a sufficient merge criteria when adding types.
1 parent f649184 commit 0cfd14e

File tree

1 file changed

+3
-6
lines changed

1 file changed

+3
-6
lines changed

app/code/Magento/Theme/Model/Config/Processor/DesignTheme.php

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -51,10 +51,10 @@ public function process(array $config)
5151
{
5252
foreach ($config as $scope => &$item) {
5353
if ($scope === \Magento\Framework\App\Config\ScopeConfigInterface::SCOPE_TYPE_DEFAULT) {
54-
$item = $this->changeThemeFullPathToIdentifier($item);
54+
$item = $this->changeThemeFullPathToIdentifier($item ?? []);
5555
} else {
5656
foreach ($item as &$scopeItems) {
57-
$scopeItems = $this->changeThemeFullPathToIdentifier($scopeItems);
57+
$scopeItems = $this->changeThemeFullPathToIdentifier($scopeItems ?? []);
5858
}
5959
}
6060
}
@@ -65,11 +65,8 @@ public function process(array $config)
6565
/**
6666
* Check \Magento\Framework\View\DesignInterface::XML_PATH_THEME_ID config path
6767
* and convert theme_full_path (Ex. "frontend/Magento/blank") to theme_id
68-
*
69-
* @param array $configItems
70-
* @return array
7168
*/
72-
private function changeThemeFullPathToIdentifier($configItems)
69+
private function changeThemeFullPathToIdentifier(array $configItems): array
7370
{
7471
$theme = null;
7572
$themeIdentifier = $this->arrayManager->get(DesignInterface::XML_PATH_THEME_ID, $configItems);

0 commit comments

Comments
 (0)