From 6e69904bfe614f0c73977675b541f12dae6f8aa9 Mon Sep 17 00:00:00 2001
From: Helmut Hummel <typo3@helhum.io>
Date: Tue, 19 May 2020 23:13:13 +0200
Subject: [PATCH] [BUGFIX] Correctly evaluate PageTS in TemplateModule

Set the current page id early, so that PageTS is fetched
from the correct page instead of id 0.

Releases: 9.5, master
Resolves: #91445
Change-Id: I95a50b6c9d45be54291f27828d9f35cb62b3b4dd
Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/64553
Reviewed-by: Daniel Siepmann <coding@daniel-siepmann.de>
Reviewed-by: Thomas Hohn
Reviewed-by: Benni Mack <benni@typo3.org>
Reviewed-by: Helmut Hummel <typo3@helhum.io>
Tested-by: TYPO3com <noreply@typo3.com>
Tested-by: Benni Mack <benni@typo3.org>
Tested-by: Helmut Hummel <typo3@helhum.io>
---
 .../Classes/Controller/TypoScriptTemplateModuleController.php   | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/typo3/sysext/tstemplate/Classes/Controller/TypoScriptTemplateModuleController.php b/typo3/sysext/tstemplate/Classes/Controller/TypoScriptTemplateModuleController.php
index 3e8a4d18f07a..7d09a4b41e94 100644
--- a/typo3/sysext/tstemplate/Classes/Controller/TypoScriptTemplateModuleController.php
+++ b/typo3/sysext/tstemplate/Classes/Controller/TypoScriptTemplateModuleController.php
@@ -192,11 +192,11 @@ class TypoScriptTemplateModuleController
     public function mainAction(ServerRequestInterface $request): ResponseInterface
     {
         $this->request = $request;
+        $this->id = (int)($request->getParsedBody()['id'] ?? $request->getQueryParams()['id'] ?? 0);
         $changedMenuSettings = $request->getParsedBody()['SET'] ?? $request->getQueryParams()['SET'] ?? [];
         $this->menuConfig($changedMenuSettings);
         // Loads $this->extClassConf with the configuration for the CURRENT function of the menu.
         $this->extClassConf = $this->getExternalItemConfig('web_ts', 'function', $this->MOD_SETTINGS['function']);
-        $this->id = (int)($request->getParsedBody()['id'] ?? $request->getQueryParams()['id'] ?? 0);
         $this->perms_clause = $this->getBackendUser()->getPagePermsClause(Permission::PAGE_SHOW);
 
         // Checking for first level external objects
-- 
GitLab