Review main Merged

91246[TASK] Merge FE init and preparation middlewares

Christian Kuhn CR +2 V +2 Hard +128 −169 updated 10/27/25, 11:18

Commit message

The patch merges TypoScriptFrontendInitialization middleware
into PrepareTypoScriptFrontendRendering. This was on our list
for quite a while already since the two are logically directly
connected and run after each other.

This became even more obvious with TSFE being mostly dissolved.
PrepareTypoScriptFrontendRendering now takes care of creating
PageInformation, cache determination, locking and TypoScript
calculation in one go, which allows for some cleanups, more
obvious and better documented code paths, ending up with a
simplified middleware chain.

The middleware key for (vanished) TypoScriptFrontendInitialization
was 'typo3/cms-frontend/tsfe'. This one is gone. The key
'typo3/cms-frontend/prepare-tsfe-rendering' for
PrepareTypoScriptFrontendRendering is kept. This approach has
been chosen since all affected known custom extensions use the
latter one: They tend to do something *after* TypoScript has been
determined and thus reference this key in 'after'. With the
DependencyResolver being forgiving on non existing edges in
dependency matrixes, and these keys/knots being marked 'internal'
anyway, this change is not perceived as breaking.

As a side effect, the `$GLOBALS['TYPO3_REQUEST'] = $request`
b/w compat layer is now set exactly once and not twice.

Review

  • Code review CR +2 Done
    • Christian Kuhn +2
    • Stefan Bürk +1
    • Benni Mack +1
  • Verified V +2 Done
    • Christian Kuhn +2
    • Stefan Bürk +1
    • Benni Mack +1
    • core-ci +1 CI

Issues 2

Files 8

Review log 1827

Show 12 earlier messages
  1. Christian Kuhn uploaded patch set 1 10/24/25, 23:52

  2. core-ci voted on patch set 1 V -1 10/25/25, 00:04 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/87534

  1. Christian Kuhn uploaded patch set 2 V -1 10/25/25, 00:27

  2. core-ci voted on patch set 2 V +1 10/25/25, 00:34 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/87536

  3. Christian Kuhn uploaded patch set 3 V +1 10/25/25, 00:44

  4. Christian Kuhn updated the commit message in patch set 4 10/25/25, 00:48

  5. core-ci voted on patch set 3 V +1 10/25/25, 00:51 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/87537

  6. Christian Kuhn uploaded patch set 5 10/25/25, 00:53

  7. Christian Kuhn updated the commit message in patch set 6 10/25/25, 00:54

  8. core-ci voted on patch set 4 V +1 10/25/25, 00:56 Copied votes on follow-up patch sets have been updated: * Verified+1 has been copied to patch set 5 (copy condition: "changekind:NO_CHANGE"). Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/87538

  9. Christian Kuhn updated the commit message in patch set 7 10/25/25, 00:59

  10. core-ci voted on patch set 5 V +1 10/25/25, 01:02 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/87539

  11. core-ci voted on patch set 6 V +1 10/25/25, 01:04 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/87540

  12. core-ci voted on patch set 7 V +1 10/25/25, 01:09 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/87541

  13. Garvin Hicking commented on patch set 7 10/25/25, 04:16

    I think we need an Important.tst file that mentions the removed tsfe middleware key. the other was noted as internal, and at least I referenced the tsfe key for that in customer inplementations - and I've seen other agency code also reference it. Or better, could we have an alias? Otherwise I winder middleware stacks would be messed up.
  14. Oliver Klee updated the commit message in patch set 8 V +1 10/25/25, 07:41

  15. core-ci voted on patch set 8 V +1 10/25/25, 07:48 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/87563

  16. Christian Kuhn commented on patch set 8 10/25/25, 10:30

    Reply

    there are 6 reasons to *not* document the removal of typo3/cms-frontend/tsfe and i mentioned them all already: * the key has this comment: "/** internal: do not use or reference this middleware in your own code, as this will be possibly be removed */" * the class is marked @internal * it does not make much technical sense to reference this key, but rather "typo3/cms-frontend/prepare-tsfe-rendering" if really required * if this key is still used in 'before' or 'after', dependencyResolver does not explode but uses other order constraints and falls back to "natural" order. great chances nothing explodes when a "later in load order extension" adds a middleware. * searching TER revealed various middleware configs referencing "prepare-tsfe-rendering" and not "tsfe". when we continue to always ignore our internal annotations by still documenting changes on them, we could give up on doing them and are back to "everything is API". in this case, i'm of the opinion to say we really have enough reasons to *not* document this internal change this time.
  17. Christian Kuhn uploaded patch set 9 V +1 10/25/25, 10:41

  18. core-ci voted on patch set 9 V +1 10/25/25, 10:49 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/87569

  19. Garvin Hicking commented on patch set 9 10/25/25, 11:38

    Reply

    My main point was that the Core's middleware identifiers are really hard to sort own extensions into, and I think we are missing an "official" entry point to be able to do something BEFORE or AFTER TSFE init. Sadly I was sure that the 'typo3/cms-frontend/tsfe' did not have the internal notation, but of course you're right that it did, too. How about to find a middle ground, we add a sentence to for example `typo3/sysext/core/Documentation/Changelog/14.0/Breaking-107831-RemovedTypoScriptFrontendController.rst` like: ``` .. note:: Due to the changes in TSFE, also the PSR request middlewares that are annotated as 'internal' received changes. Please ensure your middleware is now properly sorted and try to use ones not annotated as 'internal' to be safe. ``` That would be all I "need". We could also do that in the "final mop-up" of the TSFE changes, I believe you said there'll be a more detailed BC RST file for it. So I leave this comment here resolved. I do follow your stance, and generally think we should not need to document internal BC changes, unless: - There is widespread use of it - We offer no "non-internal" proper API and force users to use internal stuff, and then should document these BCs in at least an Important.rst Ideally if we get aware of this, we should try to introduce public API to achieve what is needed. And I think everyone is trying hard to do that, so this should be exemptions to the rule only.
  20. Stefan Bürk commented on patch set 9 10/25/25, 13:31

    Reply

    I don't think we need to take action here in any form. The middleware are marked as `@internal` and therefore already states that you have to take care if something changes (on patchlevel basis) and put proper verification in place if you deal with them. The most use-full and used middleware is the `typo3/cms-frontend/prepare-tsfe-rendering` middleware to use it to do extbase stuff after it and if that one would have been removed I would follow to have a "breaking" or a "important" for it due the casual practice for this - basicially on the huge usage. If a middleware should be before that, it should have stated both internal middlewares alreads in the *before* block and not only a single one - not doing so is than a oversight of the developer dealing/referencing to internal things. And that something which could and should be expected. The point about internal stuff is, that it explodes if you deal with it in a incorrect way and do not take care on (patchlevel) updates to verifify if it is still working. And that is the way `@internal` is working.
  21. Benni Mack commented on patch set 9 10/26/25, 14:27

    Reply

    The point of an Important is for all who actually used them so they "know". However, as the one who split this up in v9 initially (marking them internal for a reason - that they will fall together eventually), this one is one of the few exceptions, but the other way around: was especially used to be hooked in before, "typo3/cms-frontend/tsfe" was different. It'd be actually better to let these extensions fail hard (runtime exception) if they reference this name, as it was used in the wild (in at least 5 instances i've seen), and they should just change it. So I propose ONE of the following: a) let the middleware resolver fail hard if there is a reference to "typo3/cms-frontend/tsfe" b) create an Important RST c) Remove the middleware "typo3/cms-frontend/prepare-tsfe-rendering" and not "typo3/cms-frontend/tsfe" d) Remove both middleware identifiers and use a new one such as "typo3/cms-frontend/typoscript-based-page-rendering"
  22. Benni Mack commented on patch set 9 CR +1 V +1 10/26/25, 18:34

    Reply

    Just started drafting an Important.RST... however I'd like to juggle and finalize the middleware order (we still have some conceptual problems in the preview rendering) - so let's add this as one Important RST about frontend middlewares separately.
  23. Stefan Bürk voted on patch set 9 CR +1 V +1 10/27/25, 08:47

  24. Christian Kuhn voted on patch set 9 CR +2 V +2 10/27/25, 11:18

  25. Christian Kuhn merged patch set 10 10/27/25, 11:18