From 7bd5e25d290bf905fbf8254b66bedae01a5c6717 Mon Sep 17 00:00:00 2001 From: Fabian Schmengler Date: Fri, 8 May 2020 15:19:48 +0200 Subject: [PATCH] Prevent side effect on category objects store_id and url_key on save --- .../CatalogUrlRewrite/Model/CategoryUrlRewriteGenerator.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/app/code/Magento/CatalogUrlRewrite/Model/CategoryUrlRewriteGenerator.php b/app/code/Magento/CatalogUrlRewrite/Model/CategoryUrlRewriteGenerator.php index a86604672e2b4..5775d6dffee4a 100644 --- a/app/code/Magento/CatalogUrlRewrite/Model/CategoryUrlRewriteGenerator.php +++ b/app/code/Magento/CatalogUrlRewrite/Model/CategoryUrlRewriteGenerator.php @@ -124,6 +124,9 @@ protected function generateForGlobalScope( $mergeDataProvider = clone $this->mergeDataProviderPrototype; $categoryId = $category->getId(); foreach ($category->getStoreIds() as $storeId) { + if ($storeId !== Store::DEFAULT_STORE_ID) { + $category = clone $category; // prevent undesired side effects on original object + } $category->setStoreId($storeId); if (!$this->isGlobalScope($storeId) && $this->isOverrideUrlsForStore($storeId, $categoryId, $overrideStoreUrls)