[TASK] Streamline TypoScriptFrontendItitialization
This patch is the result of a careful refactoring of the TypoScriptFrontendInitialization 'body' methods. The patch establishes the new PageInformationFactory which does all the main lifting. It either returns the verified PageInformation object, or throws an early dedicated exception carrying a response from the ErrorController when something went wrong (access checks, language overlays ...), or a StatusException when ErrorController itself error'ed. When PageInformation could be determined, rendering is dispatched to middlewares below. In case of error, the code flow is streamlined to always *return* the early response, so upper middlewares can kick in. This was a mixed bag before, where such exceptions sometimes bubbled up, skipping upper middlewares. While most error scenarios are covered by the complex 'SiteHandling' related functional tests already, a set of simple additional tests is set up to check for casual things in a more obvious way. Note the internal code flow within PageInformationFactory can still be simplified and disentangled some more, but the outer class communication is fine now and the internal handling is already much more easy to follow. As drive-by, @internal getUriToCurrentPageForRedirect() is moved from TSFE to the consuming 'shortcut and mountpoint redirect' middleware. The patch also outlines flaws of the PageRepository strategy, that becomes obvious after disentangling the consuming code. It adds a todo on how PageRepository could be improved. We should follow this path soon, since the entire area with all the access and logic checks is security relevant: We want to end up with code that is as easy to grasp and follow as possible. Resolves: #102856 Related: #102715 Releases: main Change-Id: Icf65dd21ced16af521735f9af003b65ec94909c9 Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/82452 Tested-by:core-ci <typo3@b13.com> Tested-by:
Christian Kuhn <lolli@schwarzbu.ch> Reviewed-by:
Benni Mack <benni@typo3.org> Reviewed-by:
Christian Kuhn <lolli@schwarzbu.ch> Tested-by:
Stefan Bürk <stefan@buerk.tech> Reviewed-by:
Stefan Bürk <stefan@buerk.tech> Tested-by:
Benni Mack <benni@typo3.org>
Showing
- typo3/sysext/core/Classes/Context/Context.php 1 addition, 1 deletiontypo3/sysext/core/Classes/Context/Context.php
- typo3/sysext/core/Classes/Domain/Repository/PageRepository.php 4 additions, 4 deletions.../sysext/core/Classes/Domain/Repository/PageRepository.php
- typo3/sysext/core/Classes/Error/Http/StatusException.php 2 additions, 0 deletionstypo3/sysext/core/Classes/Error/Http/StatusException.php
- typo3/sysext/core/Classes/Routing/Aspect/PersistedAliasMapper.php 1 addition, 1 deletion...sext/core/Classes/Routing/Aspect/PersistedAliasMapper.php
- typo3/sysext/core/Classes/Routing/Aspect/PersistedPatternMapper.php 1 addition, 1 deletion...xt/core/Classes/Routing/Aspect/PersistedPatternMapper.php
- typo3/sysext/core/Classes/Utility/RootlineUtility.php 8 additions, 1 deletiontypo3/sysext/core/Classes/Utility/RootlineUtility.php
- typo3/sysext/core/Tests/Functional/Domain/Repository/PageRepositoryTest.php 0 additions, 5 deletions...Tests/Functional/Domain/Repository/PageRepositoryTest.php
- typo3/sysext/frontend/Classes/Controller/ErrorController.php 2 additions, 2 deletionstypo3/sysext/frontend/Classes/Controller/ErrorController.php
- typo3/sysext/frontend/Classes/Controller/TypoScriptFrontendController.php 2 additions, 27 deletions...ntend/Classes/Controller/TypoScriptFrontendController.php
- typo3/sysext/frontend/Classes/Event/AfterPageAndLanguageIsResolvedEvent.php 3 additions, 2 deletions...end/Classes/Event/AfterPageAndLanguageIsResolvedEvent.php
- typo3/sysext/frontend/Classes/Middleware/ShortcutAndMountPointRedirect.php 23 additions, 4 deletions...tend/Classes/Middleware/ShortcutAndMountPointRedirect.php
- typo3/sysext/frontend/Classes/Middleware/TypoScriptFrontendInitialization.php 40 additions, 701 deletions...d/Classes/Middleware/TypoScriptFrontendInitialization.php
- typo3/sysext/frontend/Classes/Page/PageInformationCreationFailedException.php 43 additions, 0 deletions...d/Classes/Page/PageInformationCreationFailedException.php
- typo3/sysext/frontend/Classes/Page/PageInformationFactory.php 560 additions, 0 deletions...3/sysext/frontend/Classes/Page/PageInformationFactory.php
- typo3/sysext/frontend/Configuration/Services.yaml 0 additions, 4 deletionstypo3/sysext/frontend/Configuration/Services.yaml
- typo3/sysext/frontend/Tests/Functional/Middleware/Fixtures/typoScriptFrontendInitializationBeUsers.csv 3 additions, 0 deletions...ware/Fixtures/typoScriptFrontendInitializationBeUsers.csv
- typo3/sysext/frontend/Tests/Functional/Middleware/Fixtures/typoScriptFrontendInitializationCases.csv 12 additions, 0 deletions...leware/Fixtures/typoScriptFrontendInitializationCases.csv
- typo3/sysext/frontend/Tests/Functional/Middleware/Fixtures/typoScriptFrontendInitializationFeGroupsFeUsers.csv 8 additions, 0 deletions...tures/typoScriptFrontendInitializationFeGroupsFeUsers.csv
- typo3/sysext/frontend/Tests/Functional/Middleware/Fixtures/typoScriptFrontendInitializationSysTemplate.csv 7 additions, 0 deletions.../Fixtures/typoScriptFrontendInitializationSysTemplate.csv
- typo3/sysext/frontend/Tests/Functional/Middleware/TypoScriptFrontendInitializationTest.php 226 additions, 0 deletions...ional/Middleware/TypoScriptFrontendInitializationTest.php
Please register or sign in to comment