From 8b0e90c9a485382109ea0ae491ec9b3bd6cb4247 Mon Sep 17 00:00:00 2001 From: Richard Haeser Date: Wed, 20 Jan 2021 22:37:26 +0100 Subject: [PATCH] [BUGFIX] Respect date aspect in PageRepository runtime cache Pages with a date visibility outside the current date had their preview link generated incorrectly as the runtime cache was already filled with the data of the current date. If the date aspect is taken into account proper preview links can be generated for future or past pages as well. Resolves: #92944 Releases: master, 10.4, 9.5 Change-Id: Icd5c1f8e1f0ddea07780d1ca1d1d050660443927 Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/67479 Tested-by: TYPO3com Tested-by: Richard Haeser Reviewed-by: Richard Haeser --- typo3/sysext/frontend/Classes/Page/PageRepository.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/typo3/sysext/frontend/Classes/Page/PageRepository.php b/typo3/sysext/frontend/Classes/Page/PageRepository.php index 0635fc8cf274..82d3bee0c4c6 100644 --- a/typo3/sysext/frontend/Classes/Page/PageRepository.php +++ b/typo3/sysext/frontend/Classes/Page/PageRepository.php @@ -242,8 +242,11 @@ protected function init($show_hidden) $userAspect = $this->context->getAspect('frontend.user'); $frontendUserIdentifier = 'user_' . (int)$userAspect->get('id') . '_groups_' . md5(implode(',', $userAspect->getGroupIds())); + // We need to respect the date aspect as we might have subrequests with a different time (e.g. backend preview links) + $dateTimeIdentifier = $this->context->getAspect('date')->get('timestamp'); + $cache = $this->getRuntimeCache(); - $cacheIdentifier = 'PageRepository_hidDelWhere' . ($show_hidden ? 'ShowHidden' : '') . '_' . (int)$this->versioningWorkspaceId . '_' . $frontendUserIdentifier; + $cacheIdentifier = 'PageRepository_hidDelWhere' . ($show_hidden ? 'ShowHidden' : '') . '_' . (int)$this->versioningWorkspaceId . '_' . $frontendUserIdentifier . '_' . $dateTimeIdentifier; $cacheEntry = $cache->get($cacheIdentifier); if ($cacheEntry) { $this->where_hid_del = $cacheEntry;