Review main Merged

87141[TASK] Require a template filename in extbase module template rendering

Torben Hansen CR +2 V +2 Normal +65 −0 updated 01/13/25, 14:20

Commit message

Previously, the module template methods `renderResponse()` and
`render()` could be called without providing a `$templateFileName`
in extbase backend modules. If no `$templateFileName` was provided,
the template was automatically resolved from the current extbase
controller name and action name.

With the introduction of FluidAdapter in TYPO3 v13, the dependencies
between fluid and extbase have been decoupled. It has however been
forgotten to implement and document, that a `$templateFileName` must
be provided for render-methods in `ModuleTemplate`.

With this change, render-methods in `ModuleTemplate` now throw an
`InvalidArgumentException`, when the `$templateFileName` argument
is an empty string.

Review

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

Issues 2

Files 2

Review log 3142

Show 1117 earlier messages
  1. Torben Hansen uploaded patch set 1 11/21/24, 11:03

  2. Mathias Brodala commented on patch set 1 11/21/24, 11:06

    ModuleTemplate.php:112

    Strictly speaking this default value is pointless since making use of it inevitably leads to a PHP error in the prepareRender() call.

    ModuleTemplate.php:126

    Same here.

    ModuleTemplate.php:137

    Wouldn't it make more sense to check here and reject an empty filename?
  3. core-ci voted on patch set 1 V +1 11/21/24, 11:10 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/69920

  4. Torben Hansen uploaded patch set 2 V +1 11/21/24, 11:11

  5. Torben Hansen commented on patch set 2 11/21/24, 11:12

    ModuleTemplate.php:112 Reply

    Yes, I agree that it is pointless here, but the interface currently requires this.

    ModuleTemplate.php:126 Reply

    Yes, I agree that it is pointless here, but the interface currently requires this.

    ModuleTemplate.php:137 Reply

    Done
  6. Torben Hansen rebased onto patch set 3 11/21/24, 11:13

  7. core-ci voted on patch set 2 V +1 11/21/24, 11:20 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/69922

  8. core-ci voted on patch set 3 V +1 11/21/24, 11:25 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/69924

  9. Torben Hansen uploaded patch set 4 V +1 11/21/24, 11:45

  10. core-ci voted on patch set 4 V +1 11/21/24, 11:54 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/69936

  11. Simon Praetorius commented on patch set 4 11/21/24, 12:04

    ModuleTemplate.php:133

    This is probably not always present, which could lead to a follow-up error.
  12. Torben Hansen uploaded patch set 5 V +1 11/21/24, 13:52

  13. core-ci voted on patch set 5 V +1 11/21/24, 14:00 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/69945

  14. Torben Hansen commented on patch set 5 11/21/24, 15:10

    ModuleTemplate.php:133 Reply

    Done
  15. Torben Hansen updated the commit message in patch set 6 V +1 11/21/24, 15:12

  16. core-ci voted on patch set 6 V +1 11/21/24, 15:19 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/69958

  17. Torben Hansen uploaded patch set 7 V +1 11/21/24, 16:10

  1. Garvin Hicking commented on patch set 7 11/21/24, 16:14

    could we please update the changelog entry alongside this, adding a hint on this for migration?
  2. core-ci voted on patch set 7 V +1 11/21/24, 16:16 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/69963

  3. Torben Hansen uploaded patch set 8 V +1 11/21/24, 17:38

  4. Torben Hansen commented on patch set 8 11/21/24, 17:40

    Reply

    Done
  5. core-ci voted on patch set 8 V +1 11/21/24, 17:45 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/69972

  6. Torben Hansen uploaded patch set 9 V +1 11/21/24, 19:39

  7. Torben Hansen commented on patch set 10 11/21/24, 19:40

    Published edit on patch set 9.
  8. Garvin Hicking commented on patch set 10 CR +1 V +1 11/21/24, 19:44

    Thanks!
  9. core-ci voted on patch set 9 V +1 11/21/24, 19:46 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/69982

  10. core-ci voted on patch set 10 V +1 11/21/24, 19:47 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/69983

  11. Simon Praetorius voted on patch set 10 CR +1 V +1 11/21/24, 20:58

  12. Simon Schaufelberger voted on patch set 10 CR +1 V +1 12/17/24, 18:40

  13. Stefan Bürk voted on patch set 10 CR -1 12/17/24, 19:55

  14. Stefan Bürk commented on patch set 10 CR 0 12/18/24, 16:49

    I'm not a friend of retriving the extbase attribute in the moduletemplate - the class is only used for the inline phpdocblock, which is needed for phpstan to be silent. It's even more wiring of extbase at places where it should not be hardwired in my eyes (cross dependencies). Kind of event would be nice where extbase is listening to (or others) - at least for v14/main (internal cross systextension communication event?). Or we leave the extbase determination out. Further, this does not take into account that it "may" be possible to have a none fluid based template rendering or tomorrow resolved in another structure (lowercased etc ....) Having a concrete exception is okay, I'm just stumpling around the extbase additional part .... I don't vote it but also don't block it.
  15. Oliver Klee commented on patch set 10 12/18/24, 17:43

    ModuleTemplate.php:129

    Would it make sense to annotate this as `@param non-empty-string`?
  16. Torben Hansen commented on patch set 10 12/19/24, 18:11

    ModuleTemplate.php:129 Reply

    I'm not sure if this is possible here, since when `@param non-empty-string` is added, phpstan will fail with `Strict comparison using === between non-empty-string and '' will always evaluate to false.`.
  17. Torben Hansen commented on patch set 10 01/12/25, 06:10

    ModuleTemplate.php:129 Reply

    AFAICS `@param non-empty-string` is not possible here.
  18. Oliver Hader voted on patch set 10 CR +1 01/13/25, 08:53

  19. Christian Kuhn commented on patch set 10 CR -1 01/13/25, 10:28

    ModuleTemplate.php:163

    i tend to merge this method into prepareRender() directly to make clear this logic is only used within the exception message, which makes the indirect extbase dependency less hard.
  20. Christian Kuhn uploaded patch set 11 CR +1 V +1 01/13/25, 10:35

  21. core-ci voted on patch set 11 V +1 01/13/25, 10:45 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/72305

  22. Christian Kuhn voted on patch set 11 CR +1 V +1 01/13/25, 10:46

  23. Stefan Bürk voted on patch set 11 CR +2 V +2 01/13/25, 10:49

  24. Stefan Bürk merged patch set 12 01/13/25, 10:59

  25. Oliver Klee wrote 01/13/25, 14:20

    Removed cc Oliver Klee.