Review main Merged

79572[TASK] Clean up usages of ContentObjectRenderer request attribute

Helmut Hummel CR +2 V +2 Easy +14 −17 updated 08/21/25, 13:26

Commit message

ContentObjectRenderer is now added as request attribute in
certain cases. But since the signature of obtaining an attribute
from a request correctly states, that the attribute can be null,
consuming code should account for that and defensively
fall back to defaults, when the object can not be obtained.

Review

  • Code review CR +2 Done
    • Stefan Bürk +2
    • Nikita Hovratov +1
    • Jörg Bösche +1
  • Verified V +2 Done
    • Stefan Bürk +2
    • Oliver Klee +1
    • Nikita Hovratov +1
    • core-ci +1 CI

Issues 1

Files 4

Review log 1011

  1. Helmut Hummel uploaded patch set 1 06/30/23, 15:31

  2. core-ci voted on patch set 1 V +1 06/30/23, 15:38 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/43157

  3. Oliver Klee voted on patch set 1 V +1 06/30/23, 15:57

  4. Jörg Bösche voted on patch set 1 CR +1 08/25/23, 14:09

  5. Nikita Hovratov voted on patch set 1 V +1 CR +1 09/07/23, 19:24

  6. Stefan Bürk voted on patch set 1 V +2 CR +2 09/07/23, 19:59

  7. Stefan Bürk voted on patch set 1 V +1 CR +1 09/07/23, 20:05

  8. Stefan Bürk voted on patch set 1 V +2 CR +2 09/07/23, 21:07

  9. Stefan Bürk merged patch set 2 09/07/23, 21:07

  10. Alexander Schnitzler commented on patch set 2 08/21/25, 13:00

    UriBuilder.php:520

    Sorry for the post merge complaint but this is really bad UX here when the UriBuilder suddenly returns an empty string instead of throwing an exception. I didn't check all details but we should be good here with a fresh instance of the ContentObjectRenderer since we don't need any data here. We provide all configuration necessary to create a link and the ContentObjectRenderer rather acts as a service here, calling the LinkHandler and some formatting functions like stdWrap on itself. It would be tricky if the configuration could contain a stdWrap which queries the current data but this is not the case. The whole configuration is known and determined by us via buildTypolinkConfiguration(). I recommend adding `$currentContentObject ??= new ContentObjectRenderer();` here. What do you folks think?
  11. Alexander Schnitzler commented on patch set 2 08/21/25, 13:26

    UriBuilder.php:520 Reply Unresolved

    I am just seeing that `ContentObjectRenderer::createLink()` potentially also returns an empty string. That however, has never been a problem in the past with a proper link configuration. Still, I'd opt for using the LinkFactory here directly in the future. This also needs a ContentObjectRenderer but we would then not suppress exceptions that stem from a possibly invalid configuration.