From 4e913f2af2bc0390963ba4c5f26359a51cc5673a Mon Sep 17 00:00:00 2001 From: Susanne Moog <look@susi.dev> Date: Fri, 24 Jan 2020 17:26:12 +0100 Subject: [PATCH] [BUGFIX] Adjust root line in Condition Matcher - in frontend tests: match the root line to the actual TSFE root line - in backend condition matcher: sort the root line similar to frontend (in ts config the root line was already manually sorted, this change has no impact on core code) Resolves: #90196 Releases: master, 9.5 Change-Id: Icff65a649f467a82a85ae454585643b978f17e30 Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/63024 Tested-by: TYPO3com <noreply@typo3.com> Tested-by: Tobi Kretschmann <tobi@tobishome.de> Tested-by: Daniel Goerz <daniel.goerz@posteo.de> Reviewed-by: Tobi Kretschmann <tobi@tobishome.de> Reviewed-by: Daniel Goerz <daniel.goerz@posteo.de> --- .../TypoScript/ConditionMatching/ConditionMatcher.php | 6 +++++- .../TypoScript/ConditionMatching/ConditionMatcherTest.php | 4 ++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/typo3/sysext/backend/Classes/Configuration/TypoScript/ConditionMatching/ConditionMatcher.php b/typo3/sysext/backend/Classes/Configuration/TypoScript/ConditionMatching/ConditionMatcher.php index 4647cfe94327..8d2e82540320 100644 --- a/typo3/sysext/backend/Classes/Configuration/TypoScript/ConditionMatching/ConditionMatcher.php +++ b/typo3/sysext/backend/Classes/Configuration/TypoScript/ConditionMatching/ConditionMatcher.php @@ -36,7 +36,11 @@ class ConditionMatcher extends AbstractConditionMatcher { $this->context = $context ?? GeneralUtility::makeInstance(Context::class); $this->pageId = $pageId ?? $this->determinePageId(); - $this->rootline = $rootLine ?? BackendUtility::BEgetRootLine($pageId, '', true); + if ($rootLine === null) { + $rootLine = BackendUtility::BEgetRootLine($pageId, '', true); + ksort($rootLine); + } + $this->rootline = $rootLine; $this->initializeExpressionLanguageResolver(); } diff --git a/typo3/sysext/frontend/Tests/Functional/Configuration/TypoScript/ConditionMatching/ConditionMatcherTest.php b/typo3/sysext/frontend/Tests/Functional/Configuration/TypoScript/ConditionMatching/ConditionMatcherTest.php index c723bc7d2594..35c8c4692e41 100644 --- a/typo3/sysext/frontend/Tests/Functional/Configuration/TypoScript/ConditionMatching/ConditionMatcherTest.php +++ b/typo3/sysext/frontend/Tests/Functional/Configuration/TypoScript/ConditionMatching/ConditionMatcherTest.php @@ -471,9 +471,9 @@ class ConditionMatcherTest extends FunctionalTestCase $GLOBALS['TSFE']->sys_page = GeneralUtility::makeInstance(PageRepository::class); $GLOBALS['TSFE']->tmpl = GeneralUtility::makeInstance(TemplateService::class); $GLOBALS['TSFE']->tmpl->rootLine = [ - 2 => ['uid' => 3, 'pid' => 2], + 0 => ['uid' => 1, 'pid' => 0], 1 => ['uid' => 2, 'pid' => 1], - 0 => ['uid' => 1, 'pid' => 0] + 2 => ['uid' => 3, 'pid' => 2], ]; } } -- GitLab