From 394528fd76acfbf668576e2484b9407433359bf6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafael=20K=C3=A4hm?= Date: Tue, 7 May 2024 18:40:17 +0200 Subject: [PATCH] [BUGFIX] Cast pageType and suggestPageType to int in SearchFormViewHelper Problem: Calling the `s:searchForm` ViewHelper with the `pageType` or `suggestPageType` argument with a value from a typoscript setting will lead to a TypeError ```html ``` `TYPO3\CMS\Extbase\Mvc\Web\Routing\UriBuilder::setTargetPageType(): Argument #1 ($targetPageType) must be of type int, string given, called in /var/www/html/private/typo3conf/ext/solr/Classes/ViewHelpers/SearchFormViewHelper.php` Solution: Cast both arguments to int Fixes: #3927 Ports: #3728 --- Classes/ViewHelpers/SearchFormViewHelper.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Classes/ViewHelpers/SearchFormViewHelper.php b/Classes/ViewHelpers/SearchFormViewHelper.php index ac3d1d337b..e32b27fdc0 100644 --- a/Classes/ViewHelpers/SearchFormViewHelper.php +++ b/Classes/ViewHelpers/SearchFormViewHelper.php @@ -231,7 +231,7 @@ protected function getSuggestUrl(?array $additionalFilters, int $pageUid): strin $suggestUrl = $uriBuilder ->reset() ->setTargetPageUid($pageUid) - ->setTargetPageType($this->arguments['suggestPageType']) + ->setTargetPageType((int)$this->arguments['suggestPageType']) ->setArguments([$pluginNamespace => ['additionalFilters' => $additionalFilters]]) ->build(); @@ -250,7 +250,7 @@ protected function buildUriFromPageUidAndArguments($pageUid): string return $uriBuilder ->reset() ->setTargetPageUid((int)$pageUid) - ->setTargetPageType($this->arguments['pageType'] ?? 0) + ->setTargetPageType((int)($this->arguments['pageType'] ?? 0)) ->setNoCache($this->arguments['noCache'] ?? false) ->setArguments($this->arguments['additionalParams'] ?? []) ->setCreateAbsoluteUri($this->arguments['absolute'] ?? false)