Review main Merged

75210[BUGFIX] Always call GU::trimExplode with string in extbase/fluid

Oliver Klee CR +2 V +2 Easy +8 −10 updated 07/27/22, 06:41

Commit message

This avoids problem when GU::trimExplode is switched to native type
declarations.

Also fix some possible invalid array accesses.

Review

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

Issues 1

Files 5

Review log 1720

  1. Oliver Klee uploaded patch set 1 07/16/22, 17:16

  2. core-ci voted on patch set 1 V +1 07/16/22, 17:25 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/29289

  3. Nikita Hovratov commented on patch set 1 07/16/22, 19:50

    BytesViewHelper.php:94

    theoretically this is always a string, if called from fluid templates. Not sure if we should add it anyway. What do you think?
  4. Nikita Hovratov commented on patch set 1 07/16/22, 19:51

    Related
  5. Oliver Klee updated the commit message in patch set 2 07/16/22, 20:16

  6. Oliver Klee commented on patch set 2 07/16/22, 20:16

    Reply

    Done

    BytesViewHelper.php:94 Reply

    In line 92, the translate call can return false if the localized string is not found. Referring to line 90: It's possible (although not a good idea of course) to set an integer, an array or a boolean as the "units" argument. Even in those cases, the ViewHelper should not crash with a type error.
  7. core-ci voted on patch set 2 V +1 07/16/22, 20:27 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/29300

  8. Nikita Hovratov commented on patch set 2 CR +1 07/16/22, 20:58

    BytesViewHelper.php:94 Reply

    okay. I mean ViewHelpers have their own type validation and will throw if the type does not match. But it's okay as ViewHelpers could also be called in code.
  9. Stefan Bürk commented on patch set 2 07/17/22, 11:18

    CObjectViewHelper.php:124

    Is this really needed argument key should be always there. Even if it is a "null" value - so string cast would be sufficient. Or what do I missed that the fallback is needed here ?
  10. Oliver Klee commented on patch set 2 07/17/22, 11:46

    CObjectViewHelper.php:124 Reply

    In general, view helpers can also be called from PHP. In those cases, it is not ensured that all arguments that are registered as required are actually provided. (And this helps with static analysis as PHPStan (or any other tool) cannot know of this magic.) I'd also be okay with dropping the fallback (but would prefer it to stay).
  11. Stefan Bürk commented on patch set 2 07/17/22, 13:05

    CObjectViewHelper.php:124 Reply

    Never directly used a viewhelper .. but okay, may be used in that way. Following that argumentation, all viewhelper should have fallback for all arguments then and reintroduce type/fallback checks anyway ....
  12. Oliver Klee commented on patch set 2 07/17/22, 13:06

    CObjectViewHelper.php:124 Reply

    Yes, they should have indeed (but not in this change :-) ).
  13. Oliver Klee commented on patch set 2 07/18/22, 11:37

    CObjectViewHelper.php:124 Reply

    If it helps get this change merged, I can also drop the fallbacks for the view helper arguments.
  14. Nikita Hovratov commented on patch set 2 07/19/22, 16:53

    CObjectViewHelper.php:124 Reply

    Let's do this, Oliver. The ViewHelper arguments can be done in one patch someday and it's rather an edgecase calling them in PHP code directly.
  15. Oliver Klee uploaded patch set 3 07/21/22, 10:33

  16. Oliver Klee commented on patch set 3 07/21/22, 10:33

    CObjectViewHelper.php:124 Reply

    Done.
  17. core-ci voted on patch set 3 V +1 07/21/22, 10:40 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/29398

  18. Stefan Bürk voted on patch set 3 V +1 CR +1 07/25/22, 21:00

  19. Christian Kuhn voted on patch set 3 V +2 CR +2 07/27/22, 06:41

  20. Christian Kuhn merged patch set 4 07/27/22, 06:41