Review main Merged

81853[TASK] Refer to active content element in Fluid image exception

Simon Praetorius CR +2 V +2 Hard +308 −17 updated 12/07/23, 13:06

Commit message

This patch adds context information to all exceptions thrown
in ImageViewHelpers which helps to localize missing image
files. The new exception messages include a reference to the
current table and uid, e. g. "tt_content:123".

The patch also applies the existing test cases of <f:image />
to <f:uri.image /> which currently has no test coverage.

Review

  • Code review CR +2 Done
    • Christian Kuhn +2
    • Garvin Hicking +1
  • Verified V +2 Done
    • Christian Kuhn +2
    • Garvin Hicking +1
    • core-ci +1 CI

Issues 1

Files 4

Review log 1725

  1. Simon Praetorius uploaded patch set 1 11/22/23, 14:05

  2. Simon Praetorius uploaded patch set 2 11/22/23, 14:06

  3. Simon Praetorius uploaded patch set 3 11/22/23, 14:09

  4. core-ci voted on patch set 2 V -1 11/22/23, 14:12 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/49355

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

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

  7. Simon Praetorius uploaded patch set 4 V -1 11/22/23, 14:23

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

  9. Nikita Hovratov commented on patch set 4 11/22/23, 16:19

    ImageViewHelper.php:111

    This is already available from AbstractViewHelper, no need to override it here.

    ImageViewHelper.php:240

    nitpick: This is just a glorified string concatenation here. Let's keep it simple.
  10. Simon Praetorius uploaded patch set 5 V +1 11/22/23, 17:27

  11. core-ci voted on patch set 5 V -1 11/22/23, 17:34 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/49407

  12. Simon Praetorius uploaded patch set 6 V -1 11/22/23, 17:42

  13. Simon Praetorius commented on patch set 6 11/22/23, 17:42

    ImageViewHelper.php:111 Reply

    Done

    ImageViewHelper.php:240 Reply

    Done
  14. core-ci voted on patch set 6 V -1 11/22/23, 17:48 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/49410

  15. Simon Praetorius uploaded patch set 7 V -1 11/22/23, 17:59

  16. Simon Praetorius commented on patch set 6 11/22/23, 18:02

    ImageViewHelper.php:111 Reply

    Seems like at least something similar is necessary to make phpstan happy. We're already working on a general fix for this (interface vs. TYPO3 implementation of RenderingContext), but for now we need to provide a type hint. I moved it into the function now, which is similar to how other core ViewHelpers do it.
  17. Simon Praetorius uploaded patch set 8 11/22/23, 18:03

  18. core-ci voted on patch set 7 V -1 11/22/23, 18:05 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/49412

  19. core-ci voted on patch set 8 V +1 11/22/23, 18:08 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/49413

  20. Georg Ringer commented on patch set 8 11/22/23, 20:36

    can we also add the media field? having a bigger model with more relations doesn't help too much? without testing, what is if newsItem.category.media triggers an error. is it then news or category record?
  21. Nikita Hovratov commented on patch set 8 11/23/23, 08:15

    ImageViewHelper.php:111 Reply

    Ack
  22. Simon Praetorius commented on patch set 8 11/23/23, 13:41

    Reply

    I think that it will be hard to cover the different use cases. The patch is currently pretty generic as long as a content object exists. To extend this, we would need to check the different inputs (file vs. file reference vs. static file). And in any case, I don't think it would be possible to get the whole chain (content => news => category). I would suggest to keep this patch simple and to extend it in a next step if it's useful.
  23. Garvin Hicking commented on patch set 8 CR +1 V +1 12/06/23, 12:43

    Nice idea, and would help our projects a lot to get something like it off the ground. Also: I need the Uri.Image viewhelper tests in main. Any chance to get this patch merged on the fast-lane (in main at least), or seperate the imageviewhelper test as a distinct patch? :-)
  24. Christian Kuhn voted on patch set 8 CR +2 V +2 12/07/23, 13:06

  25. Christian Kuhn merged patch set 9 12/07/23, 13:06