[BUGFIX] Ensure TSconfig order is identical in BE and FE 22/56122/2
authorMarkus Klein <markus.klein@typo3.org>
Mon, 12 Mar 2018 22:04:29 +0000 (23:04 +0100)
committerSusanne Moog <susanne.moog@typo3.org>
Tue, 13 Mar 2018 09:43:26 +0000 (10:43 +0100)
Make sure the inclusion order of TSconfig (files and record field)
are identical in BE and FE. As BE and FE use different algorithms,
FE is adjusted to match the BE behaviour, which is the expected one.

Resolves: #84227
Releases: master, 8.7
Change-Id: Idb4afbd736ed65890850ee75d572a55c3a5ab24d
Reviewed-on: https://review.typo3.org/56122
Tested-by: TYPO3com <no-reply@typo3.com>
Reviewed-by: Wouter Wolters <typo3@wouterwolters.nl>
Reviewed-by: Andreas Fernandez <a.fernandez@scripting-base.de>
Reviewed-by: Stefan Neufeind <typo3.neufeind@speedpartner.de>
Tested-by: Stefan Neufeind <typo3.neufeind@speedpartner.de>
Reviewed-by: Susanne Moog <susanne.moog@typo3.org>
Tested-by: Susanne Moog <susanne.moog@typo3.org>
typo3/sysext/frontend/Classes/Controller/TypoScriptFrontendController.php

index 43740d8..0dbfdf7 100644 (file)
@@ -3964,10 +3964,14 @@ class TypoScriptFrontendController implements LoggerAwareInterface
         if (!is_array($this->pagesTSconfig)) {
             $TSdataArray = [];
             foreach ($this->rootLine as $k => $v) {
+                // add TSconfig first, as $TSdataArray is reversed below and it shall be included last
+                $TSdataArray[] = $v['TSconfig'];
                 if (trim($v['tsconfig_includes'])) {
                     $includeTsConfigFileList = GeneralUtility::trimExplode(',', $v['tsconfig_includes'], true);
+                    // reverse the includes first to make sure their order is preserved when $TSdataArray is reversed
+                    $includeTsConfigFileList = array_reverse($includeTsConfigFileList);
                     // Traversing list
-                    foreach ($includeTsConfigFileList as $key => $includeTsConfigFile) {
+                    foreach ($includeTsConfigFileList as $includeTsConfigFile) {
                         if (strpos($includeTsConfigFile, 'EXT:') === 0) {
                             list($includeTsConfigFileExtensionKey, $includeTsConfigFilename) = explode(
                                 '/',
@@ -3987,7 +3991,6 @@ class TypoScriptFrontendController implements LoggerAwareInterface
                         }
                     }
                 }
-                $TSdataArray[] = $v['TSconfig'];
             }
             // Adding the default configuration:
             $TSdataArray[] = $GLOBALS['TYPO3_CONF_VARS']['BE']['defaultPageTSconfig'];