Skip to content

Commit

Permalink
[BUGFIX] fix infinite loop in Tsfe::getPidToUseForTsfeInitialization()
Browse files Browse the repository at this point in the history
Fixes #3306
Ports: #3328
  • Loading branch information
dkd-kaehm committed Aug 26, 2022
1 parent f9edd8b commit 3a2b8d0
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions Classes/FrontendEnvironment/Tsfe.php
Original file line number Diff line number Diff line change
Expand Up @@ -355,6 +355,9 @@ protected function getCacheIdentifier(int $pageId, int $language, ?int $rootPage
*/
protected function getPidToUseForTsfeInitialization(int $pidToUse, ?int $rootPageId = null): ?int
{
$incomingPidToUse = $pidToUse;
$incomingRootPageId = $rootPageId;

// handle plugin.tx_solr.index.queue.[indexConfig].additionalPageIds
if (isset($rootPageId) && !$this->isRequestedPageAPartOfRequestedSite($pidToUse)) {
return $rootPageId;
Expand All @@ -377,6 +380,15 @@ protected function getPidToUseForTsfeInitialization(int $pidToUse, ?int $rootPag
if (isset($rootPageId)) {
return $rootPageId;
}

// Check for recursion that can happen if the root page is a sysfolder with a typoscript template
if ($pidToUse === $incomingPidToUse && $rootPageId === $incomingRootPageId) {
throw new Exception\Exception(
"Infinite recursion detected while looking for the closest page with active template to page \"$askedPid\" . Please note that the page with active template (usually the root page of the current tree) MUST NOT be a sysfolder.",
1637339476
);
}

return $this->getPidToUseForTsfeInitialization($pidToUse, $rootPageId);
}

Expand Down

0 comments on commit 3a2b8d0

Please sign in to comment.