Skip to content
Snippets Groups Projects
Commit 815ded3f authored by Christoph Lehmann's avatar Christoph Lehmann Committed by Stefan Bürk
Browse files

[BUGFIX] Prevent endless loop in PageLinkBuilder

By re-using an already resolved page #99612 introduced an endless loop
during HMENU/Sitemap rendering: An external page (doktype=3) with a
simple query string like '?showModal=1' resolves to itself over and over
where the current page is the correct target.

Resolves: #100188
Releases: main

Change-Id: If81b558125706bc17dd76adaf91dec4039427121
Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/78140


Tested-by: default avatarStefan Bürk <stefan@buerk.tech>
Reviewed-by: default avatarBenni Mack <benni@typo3.org>
Reviewed-by: default avatarStefan Bürk <stefan@buerk.tech>
Tested-by: default avatarcore-ci <typo3@b13.com>
Tested-by: default avatarBenni Mack <benni@typo3.org>
parent ce947d5b
Branches
Tags
No related merge requests found
......@@ -379,7 +379,11 @@ class PageLinkBuilder extends AbstractTypolinkBuilder
if (isset($configuration['page']) && $configuration['page'] instanceof Page) {
$page = $configuration['page']->getTranslationSource()?->toArray() ?? $configuration['page']->toArray();
} else {
}
// A page with doktype external and ?showModal=1 in url field leads to recursion in HMENU/Sitemap.
// In the second call of this function $linkDetails['pageuid'] is different (=current page) to uid of Page
// object and it need to be fetched again.
if (($page['uid'] ?? false) !== $linkDetails['pageuid']) {
$page = $pageRepository->getPage($linkDetails['pageuid'], $disableGroupAccessCheck);
}
......
......@@ -157,6 +157,7 @@ entities:
- self: {id: 2132, title: 'Malloys History - Hidden', hidden: 1, 'slug': '/malloy/history'}
- self: {id: 2700, title: 'Announcements & News', type: *pageMount, mount: 7100, slug: '/news'}
- self: {id: 2800, title: 'What is a blog on Wikipedia ', type: *pageExternalUrl, url: 'https://en.wikipedia.org/wiki/Blog', slug: '/what-is-a-blog', target: 'a_new_tab' }
- self: {id: 2810, title: 'Link to a query parameter', type: *pageExternalUrl, url: '?showOption=1', slug: '/query-parameter' }
- self: {id: 2900, title: 'What is Wikipedia in a separate window ', type: *pageExternalUrl, url: 'https://en.wikipedia.org/', slug: '/wikipedia' }
children:
- self: {id: 2910, title: 'Contact wikipedia', type: *pageExternalUrl, url: 'mailto:you-never-get-an-answer', nav_hide: 1, slug: '/wikipedia/send-an-email' }
......
......@@ -711,6 +711,7 @@ class SlugLinkGeneratorTest extends AbstractTestCase
],
],
['title' => 'What is a blog on Wikipedia', 'link' => 'https://en.wikipedia.org/wiki/Blog', 'target' => 'a_new_tab'],
['title' => 'Link to a query parameter', 'link' => '/authors?showOption=1&cHash=3ba1e68f3a2f76b865952c40b7c82c8b', 'target' => ''],
// target is empty because no fluid_styled_content typoscript with config.extTarget is active
['title' => 'What is Wikipedia in a separate window', 'link' => 'https://en.wikipedia.org/', 'target' => ''],
['title' => 'ACME Inc', 'link' => 'https://acme.us/welcome', 'target' => ''],
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment