diff --git a/typo3/sysext/core/Classes/TypoScript/TemplateService.php b/typo3/sysext/core/Classes/TypoScript/TemplateService.php index f43210bc552ff6f6f6450b8f9025a4030623244a..b89e39aacb2276c6280700058ff41ed4fa67929f 100644 --- a/typo3/sysext/core/Classes/TypoScript/TemplateService.php +++ b/typo3/sysext/core/Classes/TypoScript/TemplateService.php @@ -690,38 +690,6 @@ class TemplateService } } - /** - * This function can be used to update the data of the current rootLine - * e.g. when a different language is used. - * - * This function must not be used if there are different pages in the - * rootline as before! - * - * @param array $fullRootLine Array containing the FULL rootline (up to the TYPO3 root) - * @throws \RuntimeException If the given $fullRootLine does not contain all pages that are in the current template rootline - */ - public function updateRootlineData($fullRootLine) - { - if (!is_array($this->rootLine) || empty($this->rootLine)) { - return; - } - - $fullRootLineByUid = []; - foreach ($fullRootLine as $rootLineData) { - $fullRootLineByUid[$rootLineData['uid']] = $rootLineData; - } - - foreach ($this->rootLine as $level => $dataArray) { - $currentUid = $dataArray['uid']; - - if (!array_key_exists($currentUid, $fullRootLineByUid)) { - throw new \RuntimeException(sprintf('The full rootLine does not contain data for the page with the uid %d that is contained in the template rootline.', $currentUid), 1370419654); - } - - $this->rootLine[$level] = $fullRootLineByUid[$currentUid]; - } - } - /** * Includes static template files (from extensions) for the input template record row. * diff --git a/typo3/sysext/core/Documentation/Changelog/12.0/Breaking-96351-UnusedTemplateService-updateRootlineDataMethodRemoved.rst b/typo3/sysext/core/Documentation/Changelog/12.0/Breaking-96351-UnusedTemplateService-updateRootlineDataMethodRemoved.rst new file mode 100644 index 0000000000000000000000000000000000000000..6aa210cd74cfdcfdbbbdf7ec40b347c46b3713b1 --- /dev/null +++ b/typo3/sysext/core/Documentation/Changelog/12.0/Breaking-96351-UnusedTemplateService-updateRootlineDataMethodRemoved.rst @@ -0,0 +1,43 @@ +.. include:: ../../Includes.txt + +============================================================================ +Breaking: #96351 - Unused TemplateService->updateRootlineData method removed +============================================================================ + +See :issue:`96351` + +Description +=========== + +The PHP method `TemplateService->updateRootlineData()` is removed. + +It was used as a workaround to update the fetched Rootline with +translated pages until TYPO3 v10. This was necessary because the +TypoScript information contained the language information, and +then the page translations were loaded accordingly. + +Since TYPO3 v11 the language is resolved earlier, at the same +time as the page ID, and the mechanism became obsolete. + + +Impact +====== + +Calling the method in PHP will throw a fatal PHP error, as the method does not exist anymore. + + +Affected Installations +====================== + +TYPO3 installations, mainly legacy installations with legacy +extensions using this method to boot up their own TypoScript +parsing. + + +Migration +========= + +Calling this method is not needed anymore and can be removed +from the affected code. + +.. index:: Frontend, PHP-API, FullyScanned, ext:core \ No newline at end of file diff --git a/typo3/sysext/core/Tests/Unit/TypoScript/TemplateServiceTest.php b/typo3/sysext/core/Tests/Unit/TypoScript/TemplateServiceTest.php index 56352af8fef3cc23b0870911712a82d5e098e6c6..178b15a4d2f21cb0dac89aa0811d46dbc5e88b43 100644 --- a/typo3/sysext/core/Tests/Unit/TypoScript/TemplateServiceTest.php +++ b/typo3/sysext/core/Tests/Unit/TypoScript/TemplateServiceTest.php @@ -153,52 +153,4 @@ class TemplateServiceTest extends UnitTestCase $this->templateService->config ); } - - /** - * @test - */ - public function updateRootlineDataOverwritesOwnArrayData(): void - { - $originalRootline = [ - 0 => ['uid' => 2, 'title' => 'originalTitle'], - 1 => ['uid' => 3, 'title' => 'originalTitle2'], - ]; - - $updatedRootline = [ - 0 => ['uid' => 1, 'title' => 'newTitle'], - 1 => ['uid' => 2, 'title' => 'newTitle2'], - 2 => ['uid' => 3, 'title' => 'newTitle3'], - ]; - - $expectedRootline = [ - 0 => ['uid' => 2, 'title' => 'newTitle2'], - 1 => ['uid' => 3, 'title' => 'newTitle3'], - ]; - - $this->templateService->rootLine = $originalRootline; - $this->templateService->updateRootlineData($updatedRootline); - self::assertEquals($expectedRootline, $this->templateService->rootLine); - } - - /** - * @test - */ - public function updateRootlineDataWithInvalidNewRootlineThrowsException(): void - { - $originalRootline = [ - 0 => ['uid' => 2, 'title' => 'originalTitle'], - 1 => ['uid' => 3, 'title' => 'originalTitle2'], - ]; - - $newInvalidRootline = [ - 0 => ['uid' => 1, 'title' => 'newTitle'], - 1 => ['uid' => 2, 'title' => 'newTitle2'], - ]; - - $this->expectException(\RuntimeException::class); - $this->expectExceptionCode(1370419654); - - $this->templateService->rootLine = $originalRootline; - $this->templateService->updateRootlineData($newInvalidRootline); - } } diff --git a/typo3/sysext/install/Configuration/ExtensionScanner/Php/MethodCallMatcher.php b/typo3/sysext/install/Configuration/ExtensionScanner/Php/MethodCallMatcher.php index f9d55e2e193030a20fc244a657282554a65c77c0..6b3ad773e82944e9e319c25a3d15ccba81be9e3c 100644 --- a/typo3/sysext/install/Configuration/ExtensionScanner/Php/MethodCallMatcher.php +++ b/typo3/sysext/install/Configuration/ExtensionScanner/Php/MethodCallMatcher.php @@ -5084,4 +5084,11 @@ return [ 'Breaking-96107-DeprecatedFunctionalityRemoved.rst', ], ], + 'TYPO3\CMS\Core\TypoScript\TemplateService->updateRootlineData' => [ + 'numberOfMandatoryArguments' => 1, + 'maximumNumberOfArguments' => 1, + 'restFiles' => [ + 'Breaking-96351-UnusedTemplateService-updateRootlineDataMethodRemoved.rst', + ], + ], ];