diff --git a/typo3/sysext/frontend/Classes/Http/RequestHandler.php b/typo3/sysext/frontend/Classes/Http/RequestHandler.php index 5c2f08c0e454d3f002e990dcabc3a58f9c522245..6eedadcc4f7db8db8032c56ab6b163a1c7c07bb5 100644 --- a/typo3/sysext/frontend/Classes/Http/RequestHandler.php +++ b/typo3/sysext/frontend/Classes/Http/RequestHandler.php @@ -674,13 +674,16 @@ class RequestHandler implements RequestHandlerInterface $controller->cObj ); - $controller->INTincScript_loadJSCode(); - // Javascript inline code $inlineJS = (string)$controller->cObj->cObjGet($controller->pSetup['jsInline.'] ?? null, 'jsInline.'); // Javascript inline code for Footer $inlineFooterJs = (string)$controller->cObj->cObjGet($controller->pSetup['jsFooterInline.'] ?? null, 'jsFooterInline.'); $compressJs = (bool)($controller->config['config']['compressJs'] ?? false); + + // Needs to be called after call cObjGet() calls in order to get all headerData and footerData and replacements + // see #100216 + $controller->INTincScript_loadJSCode(); + // this option is set to "external" as default if (($controller->config['config']['removeDefaultJS'] ?? 'external') === 'external') { /* diff --git a/typo3/sysext/frontend/Tests/Functional/Controller/TypoScriptFrontendControllerTest.php b/typo3/sysext/frontend/Tests/Functional/Controller/TypoScriptFrontendControllerTest.php index 7f25da213d03eb1c0c1c169d4beb9dda34833456..10f137f318147b5a7011a09108bfab64a03d9d8a 100644 --- a/typo3/sysext/frontend/Tests/Functional/Controller/TypoScriptFrontendControllerTest.php +++ b/typo3/sysext/frontend/Tests/Functional/Controller/TypoScriptFrontendControllerTest.php @@ -19,6 +19,7 @@ namespace TYPO3\CMS\Frontend\Tests\Functional\Controller; use TYPO3\CMS\Core\Cache\Backend\Typo3DatabaseBackend; use TYPO3\CMS\Core\Tests\Functional\SiteHandling\SiteBasedTestTrait; +use TYPO3\TestingFramework\Core\Functional\Framework\Frontend\Internal\TypoScriptInstruction; use TYPO3\TestingFramework\Core\Functional\Framework\Frontend\InternalRequest; use TYPO3\TestingFramework\Core\Functional\FunctionalTestCase; @@ -76,6 +77,48 @@ class TypoScriptFrontendControllerTest extends FunctionalTestCase self::assertStringContainsString('footerDataFromUserInt', $body); } + /** + * @test + */ + public function jsIncludesWithUserIntIsRendered(): void + { + $this->importCSVDataSet(__DIR__ . '/DataSet/LiveDefaultPages.csv'); + $this->setUpFrontendRootPage( + 2, + ); + $this->writeSiteConfiguration( + 'test', + $this->buildSiteConfiguration(2, 'https://website.local/'), + [$this->buildDefaultLanguageConfiguration('EN', '/en/')] + ); + + $response = $this->executeFrontendSubRequest( + (new InternalRequest('https://website.local/en/')) + ->withPageId(2) + ->withInstructions([ + (new TypoScriptInstruction()) + ->withTypoScript([ + 'page' => 'PAGE', + 'page.' => [ + 'jsInline.' => [ + '10' => 'COA_INT', + '10.' => [ + '10' => 'TEXT', + '10.' => [ + 'value' => 'alert(yes);', + ], + ], + ], + ], + ]), + ]), + ); + + $body = (string)$response->getBody(); + self::assertStringContainsString('/*TS_inlineJSint*/ +alert(yes);', $body); + } + /** * A USER_INT method for headerAndFooterMarkersAreReplacedDuringIntProcessing() */