diff --git a/typo3/sysext/core/Documentation/Changelog/master/Breaking-23736-PageLanguageDetectionSetEarlierInFrontendRequestProcess.rst b/typo3/sysext/core/Documentation/Changelog/master/Breaking-23736-PageLanguageDetectionSetEarlierInFrontendRequestProcess.rst new file mode 100644 index 0000000000000000000000000000000000000000..425a1d38fd4d4dfdb280c7dc9f545b167d3451ec --- /dev/null +++ b/typo3/sysext/core/Documentation/Changelog/master/Breaking-23736-PageLanguageDetectionSetEarlierInFrontendRequestProcess.rst @@ -0,0 +1,56 @@ +.. include:: ../../Includes.txt + +================================================================================== +Breaking: #23736 - Page Language detection set earlier in Frontend Request Process +================================================================================== + +See :issue:`23736` + +Description +=========== + +TYPO3's Frontend Request Process previously needed a parsed TypoScript before doing the language overlay of the currently +visited page, as previous TYPO3 sites without Site Handling +used TypoScript conditions like `[globalVar = GP:L = 1]` to switch +between languages. + +This made it impossible to use conditions for accessing the translated page record like `[page["nav_title"] == "Bienvenue"]`, +which was a long outstanding conceptual issue that was finally +made possible through Site Handling. + +For this reason, the translated page is now resolved directly after the actual page and rootline resolving. + + +Impact +====== + +The translated page record (based on the fallback handling in the +Site Configuration) is now available in :php:`$TSFE->page` at a much earlier stage of the Frontend process. + +This means, TypoScript conditions based on the page record (see example above) might be different. + +In addition, the two hooks +:php:`$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['tslib/class.tslib_fe.php']['settingLanguage_preProcess']` and +:php:`$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['tslib/class.tslib_fe.php']['settingLanguage_postProcess']` are +called now earlier when no TypoScript is available yet. + + +Affected Installations +====================== + +TYPO3 installations with custom extensions using the hooks mentioned +above or that have language-specific "page-based" conditions. + + +Migration +========= + +Review the hooks or use a PSR-15 middleware to use the same place +to extend TYPO3's Frontend Request process after TypoScript was +initialized. + +Also, be sure to review any of the TypoScript conditions (possible +via the `Web->Template` module) if they are related to values only +available in the default language, which seems to be a very case however. + +.. index:: PHP-API, TypoScript, NotScanned, ext:frontend \ No newline at end of file diff --git a/typo3/sysext/frontend/Classes/Controller/TypoScriptFrontendController.php b/typo3/sysext/frontend/Classes/Controller/TypoScriptFrontendController.php index 284dbe19a732bef4d63cd0b7d6b6042a5573b756..b5fa1faa77101c927c41e2575ccdea8c5b1f99a5 100644 --- a/typo3/sysext/frontend/Classes/Controller/TypoScriptFrontendController.php +++ b/typo3/sysext/frontend/Classes/Controller/TypoScriptFrontendController.php @@ -793,6 +793,8 @@ class TypoScriptFrontendController implements LoggerAwareInterface $this->id = ($this->contentPid = (int)$this->id); // Make sure it's an integer $this->type = (int)$this->type; + // Setting language and fetch translated page + $this->settingLanguage($request); // Call post processing function for id determination: $_params = ['pObj' => &$this]; foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['tslib/class.tslib_fe.php']['determineId-PostProc'] ?? [] as $_funcRef) { @@ -2027,7 +2029,6 @@ class TypoScriptFrontendController implements LoggerAwareInterface } catch (RootLineException $e) { $this->rootLine = []; } - $this->tmpl->updateRootlineData($this->rootLine); } /** diff --git a/typo3/sysext/frontend/Classes/Middleware/PrepareTypoScriptFrontendRendering.php b/typo3/sysext/frontend/Classes/Middleware/PrepareTypoScriptFrontendRendering.php index 17781405db87a5ad08d879ae3c101f2ca30283b0..c468bb54af90f3da663ae0c510e34670d6e49547 100644 --- a/typo3/sysext/frontend/Classes/Middleware/PrepareTypoScriptFrontendRendering.php +++ b/typo3/sysext/frontend/Classes/Middleware/PrepareTypoScriptFrontendRendering.php @@ -70,11 +70,6 @@ class PrepareTypoScriptFrontendRendering implements MiddlewareInterface // After this, we should have a valid config-array ready $this->controller->getConfigArray($request); - // Setting language and locale - $this->timeTracker->push('Setting language'); - $this->controller->settingLanguage($request); - $this->timeTracker->pull(); - // Convert POST data to utf-8 for internal processing if metaCharset is different if ($this->controller->metaCharset !== 'utf-8' && $request->getMethod() === 'POST') { $parsedBody = $request->getParsedBody(); diff --git a/typo3/sysext/redirects/Classes/Service/RedirectService.php b/typo3/sysext/redirects/Classes/Service/RedirectService.php index 6805b42abd23600de8fa157cc274d4c512d5d4ad..52a189158b42a5a6424b9e326508de16121301a7 100644 --- a/typo3/sysext/redirects/Classes/Service/RedirectService.php +++ b/typo3/sysext/redirects/Classes/Service/RedirectService.php @@ -334,9 +334,9 @@ class RedirectService implements LoggerAwareInterface $frontendUserAuthentication ); $controller->fetch_the_id(); + $controller->settingLanguage(); $controller->calculateLinkVars($queryParams); $controller->getConfigArray(); - $controller->settingLanguage(); $controller->newCObj(); if (!$GLOBALS['TSFE'] instanceof TypoScriptFrontendController) { $GLOBALS['TSFE'] = $controller;