Skip to content

Commit 9588fd2

Browse files
committed
getStoreValuesForForm($empty = false, $all = false) has bad logic (undefine variable)
1 parent 0053757 commit 9588fd2

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

app/code/Magento/Store/Model/System/Store.php

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,9 @@
33
* Copyright © Magento, Inc. All rights reserved.
44
* See COPYING.txt for license details.
55
*/
6+
7+
declare(strict_types=1);
8+
69
namespace Magento\Store\Model\System;
710

811
use Magento\Framework\Data\OptionSourceInterface;
@@ -126,7 +129,7 @@ public function getStoreValuesForForm($empty = false, $all = false)
126129
if ($website->getId() != $group->getWebsiteId()) {
127130
continue;
128131
}
129-
$groupShow = false;
132+
$values = [];
130133
foreach ($this->_storeCollection as $store) {
131134
if ($group->getId() != $store->getGroupId()) {
132135
continue;
@@ -135,16 +138,12 @@ public function getStoreValuesForForm($empty = false, $all = false)
135138
$options[] = ['label' => $website->getName(), 'value' => []];
136139
$websiteShow = true;
137140
}
138-
if (!$groupShow) {
139-
$groupShow = true;
140-
$values = [];
141-
}
142141
$values[] = [
143142
'label' => str_repeat($nonEscapableNbspChar, 4) . $store->getName(),
144143
'value' => $store->getId(),
145144
];
146145
}
147-
if ($groupShow) {
146+
if (!empty($values)) {
148147
$options[] = [
149148
'label' => str_repeat($nonEscapableNbspChar, 4) . $group->getName(),
150149
'value' => $values,

0 commit comments

Comments
 (0)