From 35fe85f378c9e2d2d0976e1ab0fdfe0327c339cc Mon Sep 17 00:00:00 2001 From: Andreas Allacher <andreas@allacher.com> Date: Wed, 22 Mar 2017 08:25:35 +0100 Subject: [PATCH] [BUGFIX] INCLUDE_TYPOSCRIPT condition use correct ConditionMatcher In order to support all conditions correctly whether one is in FE or BE the condition has to be matched against the correct ConditionMatcher instead of always using the one for BE. Releases: master, 8.7, 7.6 Resolves: #80385 Change-Id: Id5e216da40000b408f96822855d97799f254d0fb Reviewed-on: https://review.typo3.org/52114 Tested-by: TYPO3com <no-reply@typo3.com> Reviewed-by: Mona Muzaffar <mona.muzaffar@gmx.de> Reviewed-by: Joerg Boesche <typo3@joergboesche.de> Reviewed-by: Frank Naegler <frank.naegler@typo3.org> Tested-by: Frank Naegler <frank.naegler@typo3.org> Reviewed-by: Anja Leichsenring <aleichsenring@ab-softlab.de> Tested-by: Anja Leichsenring <aleichsenring@ab-softlab.de> Reviewed-by: Jan Helke <typo3@helke.de> Tested-by: Jan Helke <typo3@helke.de> Reviewed-by: Christian Kuhn <lolli@schwarzbu.ch> Tested-by: Christian Kuhn <lolli@schwarzbu.ch> --- .../TypoScript/Parser/TypoScriptParser.php | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/typo3/sysext/core/Classes/TypoScript/Parser/TypoScriptParser.php b/typo3/sysext/core/Classes/TypoScript/Parser/TypoScriptParser.php index fb6abb034a63..a5db2e44ee80 100644 --- a/typo3/sysext/core/Classes/TypoScript/Parser/TypoScriptParser.php +++ b/typo3/sysext/core/Classes/TypoScript/Parser/TypoScriptParser.php @@ -14,12 +14,14 @@ namespace TYPO3\CMS\Core\TypoScript\Parser; * The TYPO3 project - inspiring people to share! */ -use TYPO3\CMS\Backend\Configuration\TypoScript\ConditionMatching\ConditionMatcher; +use TYPO3\CMS\Backend\Configuration\TypoScript\ConditionMatching\ConditionMatcher as BackendConditionMatcher; +use TYPO3\CMS\Core\Configuration\TypoScript\ConditionMatching\AbstractConditionMatcher; use TYPO3\CMS\Core\TimeTracker\TimeTracker; use TYPO3\CMS\Core\TypoScript\ExtendedTemplateService; use TYPO3\CMS\Core\Utility\GeneralUtility; use TYPO3\CMS\Core\Utility\MathUtility; use TYPO3\CMS\Core\Utility\PathUtility; +use TYPO3\CMS\Frontend\Configuration\TypoScript\ConditionMatching\ConditionMatcher as FrontendConditionMatcher; /** * The TypoScript parser @@ -829,8 +831,15 @@ class TypoScriptParser if ($condition[0] !== '[') { $condition = '[' . $condition . ']'; } - /** @var ConditionMatcher $conditionMatcher */ - $conditionMatcher = GeneralUtility::makeInstance(ConditionMatcher::class); + + /** @var AbstractConditionMatcher $conditionMatcher */ + $conditionMatcher = null; + if (TYPO3_REQUESTTYPE & TYPO3_REQUESTTYPE_FE) { + $conditionMatcher = GeneralUtility::makeInstance(FrontendConditionMatcher::class); + } else { + $conditionMatcher = GeneralUtility::makeInstance(BackendConditionMatcher::class); + } + // If it didn't match then proceed to the next include, but prepend next normal (not file) part to output string if (!$conditionMatcher->match($condition)) { $newString .= $tsContentsTillNextInclude . LF; -- GitLab