[BUGFIX] Ensure TSconfig order is identical in BE and FE 27/56127/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 10:18:22 +0000 (11:18 +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/56127
Tested-by: TYPO3com <no-reply@typo3.com>
Reviewed-by: Stefan Neufeind <typo3.neufeind@speedpartner.de>
Tested-by: Stefan Neufeind <typo3.neufeind@speedpartner.de>
typo3/sysext/frontend/Classes/Controller/TypoScriptFrontendController.php

index 71caa8a..5f6326c 100644 (file)
@@ -4135,10 +4135,14 @@ class TypoScriptFrontendController
         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(
                                 '/',
@@ -4158,7 +4162,6 @@ class TypoScriptFrontendController
                         }
                     }
                 }
-                $TSdataArray[] = $v['TSconfig'];
             }
             // Adding the default configuration:
             $TSdataArray[] = $GLOBALS['TYPO3_CONF_VARS']['BE']['defaultPageTSconfig'];