Review main Merged

71713[BUGFIX] Avoid passing null to str_contains in TypoScript Parser

TYPO3com CR +2 V +2 Easy +12 −3 updated 10/23/21, 18:26

Commit message

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 1

Review log 1823

  1. TYPO3com uploaded patch set 1 10/14/21, 10:14

  2. core-ci voted on patch set 1 V +1 10/14/21, 10:29 Core CI is happy: https://gitlab.typo3.org/typo3/CI/cms/-/pipelines/18096

  3. Oliver Klee voted on patch set 1 CR +1 10/14/21, 10:33

  4. Chris Müller voted on patch set 1 CR +1 10/14/21, 10:41

  5. Christian Kuhn commented on patch set 1 10/14/21, 13:46

    fishy title.
  6. Benni Mack updated the commit message in patch set 2 10/21/21, 09:05

  7. core-ci voted on patch set 2 V +1 10/21/21, 09:25 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/18394

  8. Chris Müller voted on patch set 2 CR +1 10/22/21, 13:15

  9. Benni Mack voted on patch set 2 V +1 CR +1 10/22/21, 13:48

  10. Guido Schmechel voted on patch set 2 CR +1 10/23/21, 14:37

  11. Stefan Bürk commented on patch set 2 CR -1 10/23/21, 15:08

    TypoScriptParser.php:717

    That does not make any sense that $string is not a string at this point. And that expection warning should be hit first in addImportsFromExternalFiles() as there is a str_contains() method call also. Better to check early at the beginning of the method if $string is a string (or empty) and return early. Should have been done already, but no need to add a further check here - which is already to late.
  12. Sybille Peters commented on patch set 2 10/23/21, 15:14

    TypoScriptParser.php:714

    Isn't it better to enforce correct type string when initializing, so for example $string = (string) self:: or even better in the function addImportsFromExternalFiles() itself? Otherwise you have to make sure $string is checked further down in the file too if reused ... addImportsFromExternalFiles() even declares @return string in php docblock, so maybe that should be fixed there?
  13. Stefan Bürk commented on patch set 2 10/23/21, 15:17

    TypoScriptParser.php:714 Reply

    See my comment. It's better to check at the beginning if $string is a string and not empty. If not early return, and prevent the need for any checking, fallback or castin in there. addImportsFromExternaFilex() should have the same check, I think.
  14. Stefan Bürk uploaded patch set 3 10/23/21, 16:18

  15. Stefan Bürk uploaded patch set 4 10/23/21, 16:19

  16. core-ci voted on patch set 3 V +1 10/23/21, 16:30 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/18446

  17. core-ci voted on patch set 4 V +1 10/23/21, 16:36 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/18447

  18. Oliver Klee wrote 10/23/21, 16:47

    Removed reviewer Oliver Klee.
  19. Stefan Bürk voted on patch set 4 V +1 CR +1 10/23/21, 18:20

  20. Christian Kuhn commented on patch set 4 10/23/21, 18:24

    Reply

    Done

    TypoScriptParser.php:714 Reply

    Done
  21. Stefan Bürk commented on patch set 4 10/23/21, 18:25

    TypoScriptParser.php:717 Reply

    Done
  22. Christian Kuhn voted on patch set 4 V +2 CR +2 10/23/21, 18:26

  23. Christian Kuhn merged patch set 5 10/23/21, 18:26