diff --git a/typo3/sysext/core/Classes/Routing/PageRouter.php b/typo3/sysext/core/Classes/Routing/PageRouter.php index aff9edca1f31de77829f9cb5223b589c15ba0651..1190dbd573fb51a02aaefdebb4a04554fde1651f 100644 --- a/typo3/sysext/core/Classes/Routing/PageRouter.php +++ b/typo3/sysext/core/Classes/Routing/PageRouter.php @@ -90,7 +90,7 @@ class PageRouter implements RouterInterface protected $cacheHashCalculator; /** - * @var \TYPO3\CMS\Core\Context\Context|null + * @var \TYPO3\CMS\Core\Context\Context */ protected $context; @@ -130,7 +130,7 @@ class PageRouter implements RouterInterface if ($requestId > 0) { if (!empty($pageId = $candidateProvider->getRealPageIdForPageIdAsPossibleCandidate($requestId))) { return new PageArguments( - $pageId, + (int)$pageId, (string)($request->getQueryParams()['type'] ?? '0'), [], [], @@ -260,7 +260,7 @@ class PageRouter implements RouterInterface // with the base of the MountPoint page, this is especially relevant for cross-domain linking // Because the language contains the full base, it is retrieved in this case. try { - [, $mountPointPage] = explode('-', reset($mountPointPairs)); + [, $mountPointPage] = explode('-', (string)reset($mountPointPairs)); $site = GeneralUtility::makeInstance(SiteMatcher::class) ->matchByPageId((int)$mountPointPage); $language = $site->getLanguageById($language->getLanguageId()); diff --git a/typo3/sysext/core/Classes/Routing/PageSlugCandidateProvider.php b/typo3/sysext/core/Classes/Routing/PageSlugCandidateProvider.php index a0cf77a67406b73abb32913b94f899ef723a48aa..c87c0037276513763310be88a37c672c1cc83816 100644 --- a/typo3/sysext/core/Classes/Routing/PageSlugCandidateProvider.php +++ b/typo3/sysext/core/Classes/Routing/PageSlugCandidateProvider.php @@ -304,6 +304,7 @@ class PageSlugCandidateProvider // Add possible sub-pages prepended with the MountPoint page slug if ($mountPageInformation) { + /** @var array $mountedPage */ $siteOfMountedPage = $siteFinder->getSiteByPageId((int)$mountedPage['uid']); $morePageCandidates = $this->findPageCandidatesOfMountPoint( $row, @@ -447,7 +448,7 @@ class PageSlugCandidateProvider if (!empty($redecorationPattern) && preg_match('#' . $redecorationPattern . '#', $routePath, $matches)) { $decoration = $matches['decoration']; $decorationPattern = preg_quote($decoration, '#'); - $routePath = preg_replace('#' . $decorationPattern . '$#', '', $routePath); + $routePath = preg_replace('#' . $decorationPattern . '$#', '', $routePath) ?? ''; } $candidatePathParts = []; diff --git a/typo3/sysext/core/Classes/Routing/PageUriMatcher.php b/typo3/sysext/core/Classes/Routing/PageUriMatcher.php index 3ec665d055e88dfe1b47b1d870c521d4565d7fa4..c961d31e0eda0aa1ba5f473bf655407c2a5650b5 100644 --- a/typo3/sysext/core/Classes/Routing/PageUriMatcher.php +++ b/typo3/sysext/core/Classes/Routing/PageUriMatcher.php @@ -32,7 +32,7 @@ use TYPO3\CMS\Core\Routing\Aspect\MappableProcessor; class PageUriMatcher { /** - * @var RouteCollection + * @var RouteCollection<string, Route> */ protected $routes; @@ -69,7 +69,7 @@ class PageUriMatcher * Tries to match a URL with a set of routes. * * @param string $urlPath The path info to be parsed - * @param RouteCollection $routes The set of routes + * @param RouteCollection<string,Route> $routes The set of routes * @return array An array of parameters */ protected function matchCollection(string $urlPath, RouteCollection $routes): ?array diff --git a/typo3/sysext/core/Classes/Routing/SiteMatcher.php b/typo3/sysext/core/Classes/Routing/SiteMatcher.php index b2c1a0bd93ccff577ae3db8acd34e63eaa5b28d9..7d4957baf99c995c5bffb200e75a611144c602a7 100644 --- a/typo3/sysext/core/Classes/Routing/SiteMatcher.php +++ b/typo3/sysext/core/Classes/Routing/SiteMatcher.php @@ -90,7 +90,7 @@ class SiteMatcher implements SingletonInterface */ public function matchRequest(ServerRequestInterface $request): RouteResultInterface { - $site = null; + $site = new NullSite(); $language = null; $defaultLanguage = null; @@ -125,7 +125,7 @@ class SiteMatcher implements SingletonInterface $context = new RequestContext( '', $request->getMethod(), - HttpUtility::idn_to_ascii($request->getUri()->getHost()), + (string)HttpUtility::idn_to_ascii($request->getUri()->getHost()), $request->getUri()->getScheme(), // Ports are only necessary for URL generation in Symfony which is not used by TYPO3 80, @@ -202,7 +202,7 @@ class SiteMatcher implements SingletonInterface ['site' => $site, 'language' => $siteLanguage, 'tail' => ''], array_filter(['tail' => '.*', 'port' => (string)$uri->getPort()]), ['utf8' => true], - HttpUtility::idn_to_ascii($uri->getHost()) ?: '', + (string)(HttpUtility::idn_to_ascii($uri->getHost()) ?: ''), $uri->getScheme() ); $identifier = 'site_' . $site->getIdentifier() . '_' . $siteLanguage->getLanguageId();