[BUGFIX] INCLUDE_TYPOSCRIPT condition use correct ConditionMatcher 14/52114/8
authorAndreas Allacher <andreas@allacher.com>
Wed, 22 Mar 2017 07:25:35 +0000 (08:25 +0100)
committerChristian Kuhn <lolli@schwarzbu.ch>
Thu, 11 May 2017 10:59:53 +0000 (12:59 +0200)
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>
typo3/sysext/core/Classes/TypoScript/Parser/TypoScriptParser.php

index fb6abb0..a5db2e4 100644 (file)
@@ -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;