From 9367c811447bcf16bbcbfaca98f191c5601d8ba6 Mon Sep 17 00:00:00 2001 From: ahuininga-orisha <> Date: Wed, 13 May 2026 12:29:16 +0200 Subject: [PATCH 1/2] fix: unserialize error --- src/Model/LandingPage.php | 15 +++++++++++++-- src/Model/UrlFinder.php | 8 +++++++- 2 files changed, 20 insertions(+), 3 deletions(-) diff --git a/src/Model/LandingPage.php b/src/Model/LandingPage.php index dbd264a..2dad305 100644 --- a/src/Model/LandingPage.php +++ b/src/Model/LandingPage.php @@ -346,11 +346,22 @@ public function setFilterAttributes(?string $filterAttributes): LandingPageInter */ public function getUnserializedFilterAttributes(): array { - if ($this->getFilterAttributes() === null) { + $raw = $this->getFilterAttributes(); + if ($raw === null || $raw === '') { return []; } - return unserialize($this->getFilterAttributes()); + try { + $result = unserialize($raw, ['allowed_classes' => false]); + } catch (\Throwable $e) { + return []; + } + + if (!is_array($result)) { + return []; + } + + return $result; } /** diff --git a/src/Model/UrlFinder.php b/src/Model/UrlFinder.php index 3dfbd9a..b4ac0e5 100644 --- a/src/Model/UrlFinder.php +++ b/src/Model/UrlFinder.php @@ -150,7 +150,13 @@ protected function loadPageLookupArray(): array $landingPageLookup = []; foreach ($this->landingPageRepository->getList($searchCriteria)->getItems() as $landingPage) { - $hash = $this->createHashForFilters($landingPage->getFilters(), $landingPage->getCategoryId()); + try { + $filters = $landingPage->getFilters(); + } catch (\Throwable $e) { + continue; + } + + $hash = $this->createHashForFilters($filters, $landingPage->getCategoryId()); /** @phpstan-ignore-next-line */ $storeId = $landingPage->getData('store_id'); /** @phpstan-ignore-next-line */ From 9c458fd06b3f55e815626d36cb4f5d8bd0373341 Mon Sep 17 00:00:00 2001 From: ahuininga-orisha <> Date: Wed, 13 May 2026 12:51:27 +0200 Subject: [PATCH 2/2] Grumphp fixes --- src/Model/LandingPage.php | 3 ++- src/Model/UrlFinder.php | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/Model/LandingPage.php b/src/Model/LandingPage.php index 2dad305..b2b4cc0 100644 --- a/src/Model/LandingPage.php +++ b/src/Model/LandingPage.php @@ -12,6 +12,7 @@ use Magento\Framework\Model\AbstractExtensibleModel; use Magento\Framework\Registry; use Magento\Framework\Model\Context; +use Exception; use Magento\Framework\Model\ResourceModel\AbstractResource; /** @@ -353,7 +354,7 @@ public function getUnserializedFilterAttributes(): array try { $result = unserialize($raw, ['allowed_classes' => false]); - } catch (\Throwable $e) { + } catch (Exception $e) { return []; } diff --git a/src/Model/UrlFinder.php b/src/Model/UrlFinder.php index b4ac0e5..35dfbf1 100644 --- a/src/Model/UrlFinder.php +++ b/src/Model/UrlFinder.php @@ -10,6 +10,7 @@ use Emico\AttributeLanding\Api\Data\FilterInterface; use Emico\AttributeLanding\Api\Data\LandingPageInterface; use Emico\AttributeLanding\Api\LandingPageRepositoryInterface; +use Exception; use Magento\Framework\Api\SearchCriteriaBuilder; use Magento\Framework\App\CacheInterface; use Magento\Framework\Serialize\SerializerInterface; @@ -152,7 +153,7 @@ protected function loadPageLookupArray(): array foreach ($this->landingPageRepository->getList($searchCriteria)->getItems() as $landingPage) { try { $filters = $landingPage->getFilters(); - } catch (\Throwable $e) { + } catch (Exception $e) { continue; }