Review main Merged

73589[BUGFIX] Avoid PHP 8.1 warning passing null format to DateViewHelper

Chris Müller CR +2 V +2 Easy +13 −1 updated 03/28/22, 15:03

Commit message

Review

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

Issues 1

Files 2

Review log 2024

  1. Chris Müller uploaded patch set 1 02/17/22, 16:39

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

  3. Stefan Bürk commented on patch set 1 02/17/22, 21:59

    DateViewHelper.php:127

    Yes .. the test shows that this "may" be needed. But the issue/bug lies more in fluid. Argument "format" is registered as type string, thus it should be at least an empty string. That's the bug if a "null" value is provided in the viewhelper. If ViewHelper argument is ommited at all, the default is used. If a "null" is provided, the type is not correct. However, just commenting, not blocking this patch at all.
  4. Chris Müller commented on patch set 1 02/18/22, 08:00

    DateViewHelper.php:127 Reply

    All view helper argument values are initialised with "null" and then iterated over the given arguments in the AbstractViewHelper. In the loop is a check if the argument is available with an isset() which returns false on null. So, no value is really set (just the default value is left untouched): https://github.com/TYPO3/Fluid/blob/master/src/Core/ViewHelper/AbstractViewHelper.php#L352 https://github.com/TYPO3/Fluid/blob/cd91278da0b1b4494158568287673bd1bb943979/src/Core/ViewHelper/AbstractViewHelper.php#L444 So, for sure, this can be changed in Fluid (to initialise the arguments with the given type) but that's possibly breaking, as this may change the behaviour of custom view helpers which rely on a null argument value.
  5. Stefan Bürk commented on patch set 1 02/18/22, 13:25

    dann

    DateViewHelper.php:127 Reply

    It should at least respect the default. But in this case, if argument is set with a 'null' value, the default value is not set. If argument is not provided at all, the argument is there with the default value. That's a bug. If default value is not provided (null), thaan it should register this argument with value null, which would be the same. But if a default of "''" (empty) string is declared in the registrationArgument() call, it should be expected that this is a string and at least an empty string - and not null. However, I did not said that to block this patch at all. Just to discuss this and to eloborate if a bugfix in fluid is needed or should/must be done.
  6. Stefan Bürk commented on patch set 1 02/18/22, 13:26

    Reply

    ^ unintended - ignore it.
  7. Oliver Klee voted on patch set 1 CR +1 02/18/22, 16:30

  8. Oli Bartsch commented on patch set 1 02/18/22, 17:59

    DateViewHelper.php:127 Reply

    As Stefan already explained, when registering an argument with some type (e.g. "string") and defining a default value with the same type, the corresponding $argument must be of this type, or depending on the input value may throw some exception. Everything else seems to be a bug in the Framework for me, because there is no point in explicitly defining the type in the registration, when in the end one still needs to manually check for the argument not being NULL (or maybe even another type). Therefore I suggest to check if it's possible to fix this in the framework.
  9. Christian Kuhn commented on patch set 1 02/24/22, 23:04

    we *can* merge this, but it's imho an issue in fluid. if we start fixing this in core, i guess many more VH's will be affected and https://review.typo3.org/c/Packages/TYPO3.CMS/+/73588 is just one of them.
  10. Christian Kuhn commented on patch set 1 03/28/22, 10:25

    hey. i've had a conversation with claus about this, arguing this should be fixed in fluid. he does not agree: https://notes.typo3.org/X3W0AaGaSE2eB4xou7nIVg
  11. Christian Kuhn commented on patch set 1 03/28/22, 13:58

    DateViewHelper.php:127 Reply

    See https://notes.typo3.org/X3W0AaGaSE2eB4xou7nIVg - Claus insists this is not a fluid bug, so we'll pick that patch as is.
  12. Christian Kuhn rebased onto patch set 2 03/28/22, 13:58

  13. Christian Kuhn updated the commit message in patch set 3 03/28/22, 13:59

  14. Christian Kuhn voted on patch set 3 V +1 CR +1 03/28/22, 13:59

  15. Stefan Bürk commented on patch set 3 V +1 CR +1 03/28/22, 14:06

    DateViewHelper.php:127 Reply

    ok.
  16. Oliver Klee voted on patch set 3 CR +1 03/28/22, 14:08

  17. core-ci voted on patch set 2 V -1 03/28/22, 14:11 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/25212

  18. core-ci voted on patch set 3 V +1 03/28/22, 14:16 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/25213

  19. Christian Kuhn uploaded patch set 4 03/28/22, 14:47

  20. Oliver Klee voted on patch set 4 CR +1 03/28/22, 14:49

  21. Stefan Bürk voted on patch set 4 V +1 CR +1 03/28/22, 14:56

  22. core-ci voted on patch set 4 V +1 03/28/22, 15:00 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/25218

  23. Christian Kuhn voted on patch set 4 V +2 CR +2 03/28/22, 15:03

  24. Christian Kuhn merged patch set 5 03/28/22, 15:03