Skip to content

Commit

Permalink
[BUGFIX] Do not fall back to routes on invalid “id”
Browse files Browse the repository at this point in the history
Prevents a logic issue where any failure to load
a record from “pages” based on $_GET[‘id’]
would cause incorrect behavior of falling back
to the site’s configured root page.

Inability to load the page record requested with
“id” in URL must trigger pageNotFoundAction
instead of rendering the site’s root page.

Change-Id: I731f7d078a654e44b8a197b5bf5cb41a4727bbe9
Resolves: #89126
Releases: 9.5
Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/61657
Tested-by: TYPO3com <noreply@typo3.com>
Tested-by: Henning Liebe <h.liebe@neusta.de>
Tested-by: Benni Mack <benni@typo3.org>
Reviewed-by: Henning Liebe <h.liebe@neusta.de>
Reviewed-by: Benni Mack <benni@typo3.org>
  • Loading branch information
NamelessCoder authored and bmack committed Nov 6, 2019
1 parent 9b09fae commit deebd9f
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion typo3/sysext/frontend/Classes/Middleware/PageResolver.php
Expand Up @@ -88,7 +88,15 @@ public function process(ServerRequestInterface $request, RequestHandlerInterface
}

$requestId = (string)($request->getQueryParams()['id'] ?? '');
if (!empty($requestId) && !empty($page = $this->resolvePageId($requestId))) {
if (!empty($requestId)) {
$page = $this->resolvePageId($requestId);
if ($page === null) {
return GeneralUtility::makeInstance(ErrorController::class)->pageNotFoundAction(
$request,
'The requested page does not exist',
['code' => PageAccessFailureReasons::PAGE_NOT_FOUND]
);
}
// Legacy URIs (?id=12345) takes precedence, not matter if a route is given
$pageArguments = new PageArguments(
(int)($page['l10n_parent'] ?: $page['uid']),
Expand Down

0 comments on commit deebd9f

Please sign in to comment.