Skip to content

Commit 7bd5e25

Browse files
committed
Prevent side effect on category objects store_id and url_key on save
1 parent 6b6f428 commit 7bd5e25

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

app/code/Magento/CatalogUrlRewrite/Model/CategoryUrlRewriteGenerator.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,9 @@ protected function generateForGlobalScope(
124124
$mergeDataProvider = clone $this->mergeDataProviderPrototype;
125125
$categoryId = $category->getId();
126126
foreach ($category->getStoreIds() as $storeId) {
127+
if ($storeId !== Store::DEFAULT_STORE_ID) {
128+
$category = clone $category; // prevent undesired side effects on original object
129+
}
127130
$category->setStoreId($storeId);
128131
if (!$this->isGlobalScope($storeId)
129132
&& $this->isOverrideUrlsForStore($storeId, $categoryId, $overrideStoreUrls)

0 commit comments

Comments
 (0)