Review main Abandoned

76640[BUGFIX] Avoid undefined array key access in ImageViewHelper

Francois Suter CR 0 V 0 Easy +10 −8 updated 01/25/23, 17:09

Commit message

In `\TYPO3\CMS\Fluid\ViewHelpers\Uri\ImageViewHelper` and the
counterpart `\TYPO3\CMS\Fluid\ViewHelpers\ImageViewHelper` the
argument "fileExtension" is accessed without checking if it
is really defined. The argument is optional.

Review

  • Code review CR 0
  • Verified V 0

Issues 1

Files 2

Review log 2023

  1. Francois Suter uploaded patch set 1 11/16/22, 09:15

  2. core-ci voted on patch set 1 V +1 11/16/22, 09:22 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/33812

  3. Stefan Bürk commented on patch set 1 CR -1 11/16/22, 09:23

    on it
  4. Francois Suter commented on patch set 1 11/16/22, 09:24

    Reply

    OK. Have you seen the comment on Slack about the other ImageViewHelper?
  5. Stefan Bürk uploaded patch set 2 11/16/22, 09:27

  6. Stefan Bürk commented on patch set 2 CR -1 11/16/22, 09:28

    Reply

    nope. let me check ...
  7. Stefan Bürk uploaded patch set 3 11/16/22, 09:32

  8. Francois Suter commented on patch set 3 V +1 CR +1 11/16/22, 09:34

    Thanks for the improvements and for taking care of the other view helper.
  9. Jan Delius voted on patch set 3 CR +1 11/16/22, 09:34

  10. Markus Klein voted on patch set 3 CR +1 11/16/22, 09:40

  11. Stefan Bürk commented on patch set 3 CR -1 11/16/22, 09:42

    on it, thes will get red now ;)
  12. core-ci voted on patch set 3 V -1 11/16/22, 09:43 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/33815

  13. Markus Klein commented on patch set 3 V -1 CR 0 11/16/22, 09:46

    looking into something
  14. Stefan Bürk uploaded patch set 4 11/16/22, 09:47

  15. Markus Klein commented on patch set 3 V -1 CR -1 11/16/22, 09:53

    I can't reproduce this on v11 with PHP 8.1 Optional arguments are always initialized with `null`, hence no undefined key error
  16. Markus Klein voted on patch set 4 V -1 CR -1 11/16/22, 09:53

  17. core-ci voted on patch set 4 V +1 11/16/22, 09:56 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/33818

  18. Stefan Bürk commented on patch set 4 11/16/22, 09:58

    Reply

    We (lolli) with Claus Due - not remembering the right case, but I thing if you have that argement in your fluid template using a variable which is not defined, this leads to these kind of array key access errors. We could not convince him way back that this is an error. Not sure If lolli have fixed this in fluid yet.
  19. Stefan Bürk commented on patch set 4 11/16/22, 10:00

    Reply

    <f:image image="{image}" fileExtension="{undefinedVar}" />
  20. Oliver Klee commented on patch set 4 11/16/22, 10:11

    ImageViewHelper.php:149 Unresolved

    As $fileExtension is s string, we should do a !== ‘’ check instead.

    ImageViewHelper.php:175 Unresolved

    As $fileExtension is s string, we should do a !== ‘’ check instead.
  21. Christian Kuhn commented on patch set 4 11/16/22, 10:18

    Reply

    https://github.com/TYPO3/Fluid/issues/584 can reproduce with this functional test case: <f:image src="EXT:fluid/Tests/Functional/Fixtures/ViewHelpers/ImageViewHelperTest.jpg" width="300" height="500" crop="null" fileExtension="{{notExistingVariable}}" />
  22. Markus Klein commented on patch set 4 11/16/22, 12:03

    Reply

    So this must be fixed in Fluid! (not in all usages of arguments)
  23. Francois Suter abandoned the change 01/25/23, 17:09

    Not reproducible, happened in a single hosting for unknown reasons.