[BUGFIX] Fix page.headerData + USER_INT 81/23981/2
authorHelmut Hummel <helmut.hummel@typo3.org>
Thu, 12 Sep 2013 13:25:58 +0000 (15:25 +0200)
committerHelmut Hummel <helmut.hummel@typo3.org>
Mon, 23 Sep 2013 18:08:29 +0000 (20:08 +0200)
INT scripts placed in page.headerData.XX were
not replaced any more after introducing USER_INT
capabilities of the pageRenderer in #22273

This change reprocesses _INT placeholders after
the pageRenderer replacements have been done.

Resolves: #44825
Releases: 6.0, 6.1, 6.2
Change-Id: If11b692ed75120dbf122d95ca497b5e382fdf349
Reviewed-on: https://review.typo3.org/23981
Reviewed-by: Helmut Hummel
Tested-by: Helmut Hummel
typo3/sysext/frontend/Classes/Controller/TypoScriptFrontendController.php

index e7b73c0..a08910a 100644 (file)
@@ -3403,25 +3403,36 @@ class TypoScriptFrontendController {
                if (!empty($this->config['INTincScript_ext']['pageRenderer'])) {
                        $this->setPageRenderer(unserialize($this->config['INTincScript_ext']['pageRenderer']));
                }
-               do {
-                       $INTiS_config = $this->config['INTincScript'];
-                       $this->INTincScript_includeLibs($INTiS_config);
-                       $this->INTincScript_process($INTiS_config);
-                       // Check if there were new items added to INTincScript during the previous execution:
-                       $INTiS_config = array_diff_assoc($this->config['INTincScript'], $INTiS_config);
-                       $reprocess = count($INTiS_config) ? TRUE : FALSE;
-               } while ($reprocess);
+               $this->recursivelyReplaceIntPlaceholdersInContent();
                $GLOBALS['TT']->push('Substitute header section');
                $this->INTincScript_loadJSCode();
                $this->content = $this->getPageRenderer()->renderJavaScriptAndCssForProcessingOfUncachedContentObjects($this->content, $this->config['INTincScript_ext']['divKey']);
                $this->content = str_replace('<!--HD_' . $this->config['INTincScript_ext']['divKey'] . '-->', $this->convOutputCharset(implode(LF, $this->additionalHeaderData), 'HD'), $this->content);
                $this->content = str_replace('<!--FD_' . $this->config['INTincScript_ext']['divKey'] . '-->', $this->convOutputCharset(implode(LF, $this->additionalFooterData), 'FD'), $this->content);
                $this->content = str_replace('<!--TDS_' . $this->config['INTincScript_ext']['divKey'] . '-->', $this->convOutputCharset($this->divSection, 'TDS'), $this->content);
+               // Replace again, because header and footer data and page renderer replacements may introduce additional placeholders (see #44825)
+               $this->recursivelyReplaceIntPlaceholdersInContent();
                $this->setAbsRefPrefix();
                $GLOBALS['TT']->pull();
        }
 
        /**
+        * Replaces INT placeholders (COA_INT and USER_INT) in $this->content
+        * In case the replacement adds additional placeholders, it loops
+        * until no new placeholders are found any more.
+        */
+       protected function recursivelyReplaceIntPlaceholdersInContent() {
+               do {
+                       $INTiS_config = $this->config['INTincScript'];
+                       $this->INTincScript_includeLibs($INTiS_config);
+                       $this->INTincScript_process($INTiS_config);
+                       // Check if there were new items added to INTincScript during the previous execution:
+                       $INTiS_config = array_diff_assoc($this->config['INTincScript'], $INTiS_config);
+                       $reprocess = count($INTiS_config) ? TRUE : FALSE;
+               } while ($reprocess);
+       }
+
+       /**
         * Include libraries for uncached objects.
         *
         * @param array $INTiS_config $GLOBALS['TSFE']->config['INTincScript'] or part of it