Skip to content

Commit

Permalink
Fixed deprecation error in PHP 8.1
Browse files Browse the repository at this point in the history
When no category URL suffix is defined, the get function returns NULL causing this error: Deprecated Functionality: str_replace(): Passing null to parameter Smile-SA#1 ($search) of type array|string is deprecated
  • Loading branch information
peterjaap authored Apr 15, 2022
1 parent b736b8b commit 43d8c61
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/module-elasticsuite-virtual-category/Model/Url.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down

0 comments on commit 43d8c61

Please sign in to comment.