Review main Merged

94130[TASK] Throw exception if UriBuilder misses ContentObjectRenderer

Markus Klein CR +2 V +2 Easy +4 −1 updated 09/30/26, 21:28

Commit message

Instead of silently ignoring this circumstance and returning an empty string, the UriBuilder now throws an exception, so there is a clear trace of what's going on.

Review

  • Code review CR +2 Done
    • Benni Mack +2
    • Simon Schaufelberger +1
  • Verified V +2 Done
    • Benni Mack +2
    • Simon Schaufelberger +1
    • core-ci +1 CI

Issues 1

Files 1

Review log 1619

  1. Markus Klein uploaded patch set 1 05/22/26, 10:47

  2. core-ci voted on patch set 1 V -1 05/22/26, 10:54 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/102350

  3. Markus Klein commented on patch set 2 V -1 05/22/26, 14:06

    Published edit on patch set 1.
  4. core-ci voted on patch set 2 V +1 05/22/26, 14:16 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/102357

  5. Simon Schaufelberger voted on patch set 2 CR +1 V +1 05/22/26, 17:51

  6. Oliver Klee voted on patch set 2 CR +1 05/22/26, 19:50

  7. Oliver Klee voted on patch set 2 CR 0 05/22/26, 19:50

  8. Oliver Klee commented on patch set 2 05/22/26, 19:52

    Would it make sense to cover this with a test?

    UriBuilder.php:524

    `$currentContentObject` isn't a boolean, and we should not use a boolean operation on it. Instead, let's do one of those: ```suggestion if (!($currentContentObject instanceof ContentObjectRenderer)) { ``` or ```suggestion if ($currentContentObject === null) { ```
  9. Markus Klein commented on patch set 2 05/23/26, 08:42

    UriBuilder.php:524 Reply

    I do not have a hard opinion on that. I'm from the C/asm-era, where everything is a number and can be non-zero ;-) Since we can only get `null` or a valid object, a negation operator is totally fine for me and explicit enough. (I'm aware that PHPSTAN has some very opinionated rules about that in their strict-line, but for my personal taste a simple and straight `!` is more pleasant to read than longer `=== null` stuff.) If I'd need to choose though, I'd go with checking the error-case, which is the `null`. So feel free to adjust, if you deem it necessary.
  10. Markus Klein commented on patch set 2 05/23/26, 08:44

    Reply

    Feel free to add one. I did not take the time for this simple sanity check.
  11. Oliver Klee commented on patch set 2 05/23/26, 09:36

    Reply

    I don't know how to reproduce the conditions leading to the exception. Do you have any code to reproduce this?
  12. Markus Klein commented on patch set 2 05/23/26, 11:05

    Reply

    use a getter of an Extbase model, that uses an UriBuilder and sets the global TYPO3_REQUEST on the uribuilder. this request lacks the cObj and therefore silently fails and returns an empty url
  13. Oliver Klee wrote 05/23/26, 12:27

    Removed reviewer Oliver Klee.
  14. Markus Klein commented on patch set 2 06/16/26, 13:25

    Reply

    Done

    UriBuilder.php:524 Reply

    Done
  15. Markus Klein updated the commit message in patch set 3 CR +1 V +1 09/30/26, 12:53

  16. core-ci voted on patch set 3 V +1 09/30/26, 13:02 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/109629

  17. Simon Schaufelberger voted on patch set 3 CR +1 V +1 09/30/26, 21:03

  18. Benni Mack voted on patch set 3 CR +2 V +2 09/30/26, 21:28

  19. Benni Mack merged patch set 4 09/30/26, 21:28