From 7091f482eedc304fa8d2b45c2aaa17093c29dbb4 Mon Sep 17 00:00:00 2001 From: Markus Klein <markus.klein@typo3.org> Date: Wed, 19 Feb 2020 16:18:29 +0100 Subject: [PATCH] [BUGFIX] Calculate correct cache identifier for cached SQL statement MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit BackendUtility::getPageForRootline() must use a more specific cache identifier for the SQL statement in order to deliver correct data. Resolves: #90434 Releases: master, 9.5 Change-Id: I95cf77144773f0a2cd58b1dd72f3f818733cdc7e Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/63322 Tested-by: Wolfgang Klinger <wolfgang@wazum.com> Tested-by: Christian Eßl <indy.essl@gmail.com> Tested-by: Benni Mack <benni@typo3.org> Reviewed-by: Wolfgang Klinger <wolfgang@wazum.com> Reviewed-by: Christian Eßl <indy.essl@gmail.com> Reviewed-by: Benni Mack <benni@typo3.org> --- typo3/sysext/backend/Classes/Utility/BackendUtility.php | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/typo3/sysext/backend/Classes/Utility/BackendUtility.php b/typo3/sysext/backend/Classes/Utility/BackendUtility.php index f010560e0afa..af4d1bca06b9 100644 --- a/typo3/sysext/backend/Classes/Utility/BackendUtility.php +++ b/typo3/sysext/backend/Classes/Utility/BackendUtility.php @@ -412,11 +412,12 @@ class BackendUtility { $runtimeCache = GeneralUtility::makeInstance(CacheManager::class)->getCache('runtime'); $pageForRootlineCache = $runtimeCache->get('backendUtilityPageForRootLine') ?: []; - $ident = $uid . '-' . $clause . '-' . $workspaceOL . ($additionalFields ? '-' . md5(implode(',', $additionalFields)) : ''); + $statementCacheIdent = md5($clause . ($additionalFields ? '-' . implode(',', $additionalFields) : '')); + $ident = $uid . '-' . $workspaceOL . '-' . $statementCacheIdent; if (is_array($pageForRootlineCache[$ident] ?? false)) { $row = $pageForRootlineCache[$ident]; } else { - $statement = $runtimeCache->get('getPageForRootlineStatement'); + $statement = $runtimeCache->get('getPageForRootlineStatement-' . $statementCacheIdent); if (!$statement) { $queryBuilder = static::getQueryBuilderForTable('pages'); $queryBuilder->getRestrictions() @@ -454,7 +455,7 @@ class BackendUtility QueryHelper::stripLogicalOperatorPrefix($clause) ); $statement = $queryBuilder->execute(); - $runtimeCache->set('getPageForRootlineStatement', $statement); + $runtimeCache->set('getPageForRootlineStatement-' . $statementCacheIdent, $statement); } else { $statement->bindValue(1, (int)$uid); $statement->execute(); -- GitLab