From 3f171cb0f0b196fc13f02c18f9887d2d0d3aa2f6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adam=20W=C3=B3js?= Date: Wed, 23 Sep 2020 13:59:36 +0200 Subject: [PATCH] EZP-31935: Fixed TypeError error occuring while Section filter in Search is used (#1528) --- src/lib/View/Filter/AdminSearchViewFilter.php | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/lib/View/Filter/AdminSearchViewFilter.php b/src/lib/View/Filter/AdminSearchViewFilter.php index 137a19becd..367b82b573 100644 --- a/src/lib/View/Filter/AdminSearchViewFilter.php +++ b/src/lib/View/Filter/AdminSearchViewFilter.php @@ -9,6 +9,7 @@ namespace EzSystems\EzPlatformAdminUi\View\Filter; use eZ\Publish\API\Repository\ContentTypeService; +use eZ\Publish\API\Repository\Exceptions\NotFoundException; use eZ\Publish\API\Repository\SectionService; use eZ\Publish\Core\MVC\ConfigResolverInterface; use eZ\Publish\Core\MVC\Symfony\View\Event\FilterViewBuilderParametersEvent; @@ -103,8 +104,13 @@ public function handleSearchForm(FilterViewBuilderParametersEvent $event): void $searchLanguage = null; if (!empty($search['section'])) { - $section = $this->sectionService->loadSection($search['section']); + try { + $section = $this->sectionService->loadSection((int)$search['section']); + } catch (NotFoundException $e) { + $section = null; + } } + if (!empty($search['content_types']) && \is_array($search['content_types'])) { foreach ($search['content_types'] as $identifier) { $contentTypes[] = $this->contentTypeService->loadContentTypeByIdentifier($identifier);