Review main Merged

90974[TASK] Move FrontendTypoScriptController->contentType

Christian Kuhn CR +2 V +2 Normal +29 −23 updated 10/09/25, 18:55

Commit message

This patch itself is pretty straight forward, but needs
a bigger explanation on why we do this detail now and
why we solve it that way.

The entire story boils down to ContentObjectRenderer only
returning strings for single parts of a generated page.
This wasn't even a good idea back in the old days and
materialized in various odd constructs that tend to park
additional state elsewhere: When a content object is
rendered, it often not only wants to create some content
string that is part of the final body stream at the
current position of the generated body. It also often
wants to do additional stuff like registering some JS
in the head part of the HTML body, or some CSS, it may
want to change the HTML body tag, it may want to set
a different HTTP Response Content-Type or other header
data. All that kind of stuff: Influence the final HTTP
Response, and/or various different parts of the HTML body
stream.

But ContentObjectRenderer only allows a single cObj to return
strings. And that string is then simply concatenated
to what has been generated already. To still register stuff
like additional header files, the PageRenderer singleton has
been created to gather such body stream related things. In
addition to that, things like TSFE->contentType exists to carry
a HTTP Response detail. On top of that, various Request attributes
nowadays carry things like cache tags and cache lifetimes. And
we also have a lot of state in ContentObjectRenderer itself.
Last but not least, the frontend has the concept of uncached
elements ("USER_INT" / "COA_INT"), which park state in TSFE,
relies on a funny placeholder mechanism within the generated
body string, plus requires ContentObjectRenderer and other
instances to be serialized because its state at this point in
the rendering chain needs to be "frozen" and put into cache.
The Extbase bootstrap which fiddles a lot with Response shows
drawbacks of this approach quite well, and the 'uncached body
part' handling in TSFE is so brittle that we barely touched
it over the years, even though it has various issues and
details that don't work well in "INT" elements.

We will have to substitute the string return of single content
objects with a data object that can carry more in the future.
If solved in a good way, this will remove the need for the
stateful PageRenderer, various request attributes and more,
and we'll end up with a central place that compiles initial
Response.

We however don't know details yet and the topic is hard to
get right since we have to think about many things at once,
for instance Fluid has to be involved as well. But there are
things that have to happen as preparation: TSFE needs to vanish
to drop the cross dependency between TSFE and other things,
especially COR. Also COR needs to be turned into a service
loosing its state, which will improve "INT" handling already
and should allow getting rid of __wakeup() and __sleep().

This patch moves one further details away from TSFE: $contentType
by adding it to the already established (internal) PageParts
request attribute 'fronend.page.parts' instead. This class will
carry state for now and can be seen as a temporary solution that
represents major parts of technical debt we'll have to model
in a good way when surrounding stuff has been refactored long
enough to allow major changes.

Review

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

Issues 1

Files 4

Review log 1219

  1. Christian Kuhn uploaded patch set 1 10/09/25, 14:34

  2. Christian Kuhn uploaded patch set 2 10/09/25, 14:40

  3. core-ci voted on patch set 1 V +1 10/09/25, 14:41 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/86308

  4. core-ci voted on patch set 2 V +1 10/09/25, 14:47 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/86309

  5. Christian Kuhn uploaded patch set 3 V +1 10/09/25, 15:11

  6. Christian Kuhn uploaded patch set 4 10/09/25, 15:13

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

  8. core-ci voted on patch set 4 V -1 10/09/25, 15:23 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/86313

  9. Christian Kuhn updated the commit message in patch set 5 V -1 10/09/25, 15:58

  10. Christian Kuhn updated the commit message in patch set 6 10/09/25, 16:01

  11. Christian Kuhn updated the commit message in patch set 7 10/09/25, 16:03

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

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

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

  15. Benni Mack commented on patch set 7 CR +1 V +1 10/09/25, 16:29

    Bootstrap.php:182

    if we can ever park this stuff in frontend.page.parts as well, this would solve roughly 6 issues on forge...
  16. Anja Leichsenring voted on patch set 7 CR +1 V +1 10/09/25, 16:39

  17. Stefan Bürk voted on patch set 7 CR +1 V +1 10/09/25, 16:46

  18. Benni Mack commented on patch set 7 CR +2 V +2 10/09/25, 18:55

    Bootstrap.php:182 Reply

    Done
  19. Benni Mack merged patch set 8 10/09/25, 18:55