Review main Merged

91670[TASK] Have dependency injection in ContentObjectRenderer

Christian Kuhn CR +2 V +2 Impossible +5850 −9334 updated 11/17/25, 13:31

Commit message

ContentObjectRenderer ("COR") plays a central role in
frontend rendering: It is the main render code triggered
by RequestHandler with the top TypoScript PAGE object to
render all TypoScript content objects, which includes
all content elements.

COR never saw systematic refactoring in the past, one reason
was its connection to "upper" TypoScriptFrontendController.
Its removal enables COR cleanups.

There were two reasons that blocked COR from using dependency
injection: First, the "manual" constructor argument
TypoScriptFrontendController, which is gone now. Second, the
"current" COR instance is serialized when encountering non-cached
("INT") elements. That string representation of the class state at
this point is parked in cache to allow rendering those elements
later. COR implemented the two magic methods __sleep() and
__wakeup() to deal with serialization details. And these two
methods prevent implementing sane dependency injection.

The patch picks up an approach we applied to a similar scenario
with PageRenderer already: Implement two methods "getState()"
and "updateState()" to return a state array and reconstitute
object state. This is used in non-cached element handling instead
of serializing the full service class. The final solution is of
course to get rid of all service class state, but that needs a
much bigger refactoring which is not feasible yet. Avoiding the
two magic methods this way however allows using dependency
injection already, though.

This part is the main change coming with the patch: Remove the
magic methods, implement the two dedicated state handling
methods, and use them within "INT" handling.

The second part is what makes this change huge in lines of
changed code: Use dependency injection in COR and apply some
basic but minor cleanups (comment changes, some safe type
additions, minor method inlinings) throughout the class along
the way. Some related dependent service classes see cleanups,
too.

Having DI in COR unfortunately gives headaches with hundreds
of unit tests that tested COR directly, or that have to deal
with COR in tests as indirect dependency. The patch rewrites
all COR unit tests to functional tests and modernizes them.
This avoids tons of mocking magic and leads to much more
straight forward tests, especially for hundreds of stdWrap
tests. Some other test cases like those for single content
elements need significant rewrites as well. This tedious work
had to be done once now and makes the tests much more future
proof.

Review

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

Issues 2

Files 45

Show 25 more files

Review log 4484

Show 3159 earlier messages
  1. Christian Kuhn uploaded patch set 1 11/14/25, 22:30

  2. Christian Kuhn uploaded patch set 2 11/14/25, 22:43

  3. core-ci voted on patch set 1 V -1 11/14/25, 22:45 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/89735

  4. Christian Kuhn uploaded patch set 3 11/14/25, 22:46

  5. core-ci voted on patch set 2 V -1 11/14/25, 22:58 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/89736

  6. core-ci voted on patch set 3 V -1 11/14/25, 22:59 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/89737

  7. Christian Kuhn uploaded patch set 4 V -1 11/14/25, 23:02

  8. core-ci voted on patch set 4 V +1 11/14/25, 23:10 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/89738

  9. Christian Kuhn uploaded patch set 5 V +1 11/14/25, 23:20

  10. core-ci voted on patch set 5 V -1 11/14/25, 23:33 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/89739

  11. Christian Kuhn uploaded patch set 6 V -1 11/14/25, 23:44

  12. core-ci voted on patch set 6 V -1 11/14/25, 23:51 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/89740

  13. Christian Kuhn uploaded patch set 7 V -1 11/15/25, 00:07

  14. core-ci voted on patch set 7 V -1 11/15/25, 00:15 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/89741

  15. Christian Kuhn uploaded patch set 8 V -1 11/15/25, 00:49

  16. core-ci voted on patch set 8 V -1 11/15/25, 00:57 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/89742

  17. Christian Kuhn uploaded patch set 9 V -1 11/15/25, 00:58

  18. core-ci voted on patch set 9 V -1 11/15/25, 01:07 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/89743

  19. Christian Kuhn uploaded patch set 10 V -1 11/15/25, 01:55

  20. Christian Kuhn uploaded patch set 11 11/15/25, 02:02

  21. core-ci voted on patch set 10 V -1 11/15/25, 02:03 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/89746

  22. Christian Kuhn uploaded patch set 12 11/15/25, 02:05

  23. core-ci voted on patch set 11 V -1 11/15/25, 02:13 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/89747

  24. Christian Kuhn uploaded patch set 13 11/15/25, 02:15

  25. core-ci voted on patch set 12 V -1 11/15/25, 02:20 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/89749

  26. core-ci voted on patch set 13 V -1 11/15/25, 02:23 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/89750

  27. Christian Kuhn uploaded patch set 14 V -1 11/15/25, 03:18

  28. core-ci voted on patch set 14 V -1 11/15/25, 03:25 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/89752

  29. Christian Kuhn uploaded patch set 15 V -1 11/15/25, 03:50

  30. core-ci voted on patch set 15 V -1 11/15/25, 03:58 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/89753

  31. Christian Kuhn uploaded patch set 16 V -1 11/15/25, 13:17

  32. core-ci voted on patch set 16 V -1 11/15/25, 13:24 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/89792

  33. Christian Kuhn uploaded patch set 17 V -1 11/15/25, 13:34

  34. core-ci voted on patch set 17 V -1 11/15/25, 13:44 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/89794

  35. Christian Kuhn uploaded patch set 18 V -1 11/15/25, 13:50

  36. core-ci voted on patch set 18 V -1 11/15/25, 13:57 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/89798

  37. Christian Kuhn uploaded patch set 19 V -1 11/15/25, 14:24

  38. core-ci voted on patch set 19 V -1 11/15/25, 14:31 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/89800

  39. Christian Kuhn uploaded patch set 20 V -1 11/15/25, 16:06

  40. core-ci voted on patch set 20 V -1 11/15/25, 16:16 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/89806

  41. Christian Kuhn uploaded patch set 21 V -1 11/16/25, 00:43

  42. core-ci voted on patch set 21 V -1 11/16/25, 00:51 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/89821

  43. Christian Kuhn uploaded patch set 22 V -1 11/16/25, 02:12

  44. core-ci voted on patch set 22 V -1 11/16/25, 02:20 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/89825

  45. Christian Kuhn uploaded patch set 23 V -1 11/16/25, 03:02

  46. core-ci voted on patch set 23 V -1 11/16/25, 03:13 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/89826

  47. Christian Kuhn uploaded patch set 24 V -1 11/16/25, 03:16

  48. core-ci voted on patch set 24 V +1 11/16/25, 03:24 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/89828

  49. Christian Kuhn uploaded patch set 25 V +1 11/16/25, 03:25

  50. core-ci voted on patch set 25 V +1 11/16/25, 03:33 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/89829

  51. Christian Kuhn uploaded patch set 26 V +1 11/16/25, 03:54

  52. core-ci voted on patch set 26 V +1 11/16/25, 04:02 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/89830

  53. Christian Kuhn uploaded patch set 27 V +1 11/16/25, 15:11

  54. core-ci voted on patch set 27 V +1 11/16/25, 15:19 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/89861

  55. Christian Kuhn uploaded patch set 28 V +1 11/16/25, 15:28

  56. Christian Kuhn uploaded patch set 29 11/16/25, 15:36

  57. core-ci voted on patch set 28 V -1 11/16/25, 15:36 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/89862

  58. Christian Kuhn uploaded patch set 30 11/16/25, 15:40

  59. Christian Kuhn uploaded patch set 31 11/16/25, 15:43

  1. core-ci voted on patch set 29 V +1 11/16/25, 15:45 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/89863

  2. Christian Kuhn uploaded patch set 32 11/16/25, 15:48

  3. core-ci voted on patch set 30 V +1 11/16/25, 15:50 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/89864

  4. core-ci voted on patch set 31 V +1 11/16/25, 15:52 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/89865

  5. core-ci voted on patch set 32 V -1 11/16/25, 15:58 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/89866

  6. Christian Kuhn uploaded patch set 33 V -1 11/16/25, 16:07

  7. core-ci voted on patch set 33 V -1 11/16/25, 16:19 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/89867

  8. Christian Kuhn uploaded patch set 34 V -1 11/16/25, 17:13

  9. core-ci voted on patch set 34 V +1 11/16/25, 17:23 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/89874

  10. Christian Kuhn uploaded patch set 35 V +1 11/16/25, 17:28

  11. Christian Kuhn uploaded patch set 36 11/16/25, 17:37

  12. core-ci voted on patch set 35 V +1 11/16/25, 17:37 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/89876

  13. core-ci voted on patch set 36 V -1 11/16/25, 17:47 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/89877

  14. Christian Kuhn uploaded patch set 37 V -1 11/16/25, 18:01

  15. core-ci voted on patch set 37 V +1 11/16/25, 18:09 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/89878

  16. Christian Kuhn uploaded patch set 38 V +1 11/16/25, 18:15

  17. Christian Kuhn uploaded patch set 39 11/16/25, 18:16

  18. core-ci voted on patch set 38 V +1 11/16/25, 18:24 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/89879

  19. core-ci voted on patch set 39 V +1 11/16/25, 18:24 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/89880

  20. Christian Kuhn uploaded patch set 40 V +1 11/17/25, 10:51

  21. core-ci voted on patch set 40 V +1 11/17/25, 11:00 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/89933

  22. Stefan Bürk voted on patch set 40 CR +1 V +1 11/17/25, 12:22

  23. Anja Leichsenring voted on patch set 40 CR +1 V +1 11/17/25, 13:30

  24. Christian Kuhn voted on patch set 40 CR +2 V +2 11/17/25, 13:31

  25. Christian Kuhn merged patch set 41 11/17/25, 13:31