From 43d8c613954e809677df4492e984d14543853c3e Mon Sep 17 00:00:00 2001 From: Peter Jaap Blaakmeer Date: Fri, 15 Apr 2022 08:53:53 +0200 Subject: [PATCH] Fixed deprecation error in PHP 8.1 When no category URL suffix is defined, the get function returns NULL causing this error: Deprecated Functionality: str_replace(): Passing null to parameter #1 ($search) of type array|string is deprecated --- src/module-elasticsuite-virtual-category/Model/Url.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/module-elasticsuite-virtual-category/Model/Url.php b/src/module-elasticsuite-virtual-category/Model/Url.php index 2638a693c..5266b4499 100644 --- a/src/module-elasticsuite-virtual-category/Model/Url.php +++ b/src/module-elasticsuite-virtual-category/Model/Url.php @@ -208,7 +208,7 @@ public function getVirtualCategorySubtreeUrl($appliedRootCategory, $childCategor */ public function getCategoryRewrite($categoryPath, $storeId) { - $categoryPath = str_replace($this->getCategoryUrlSuffix(), '', $categoryPath); + $categoryPath = str_replace($this->getCategoryUrlSuffix() ?? '', '', $categoryPath); $category = $this->loadCategoryByUrlKey($categoryPath); $rewrite = null;