71713[BUGFIX] Avoid passing null to str_contains in TypoScript Parser
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
-
TYPO3com uploaded patch set 1 10/14/21, 10:14
-
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
-
Oliver Klee voted on patch set 1 CR +1 10/14/21, 10:33
-
Chris Müller voted on patch set 1 CR +1 10/14/21, 10:41
-
Christian Kuhn commented on patch set 1 10/14/21, 13:46
fishy title. -
Benni Mack updated the commit message in patch set 2 10/21/21, 09:05
-
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
-
Chris Müller voted on patch set 2 CR +1 10/22/21, 13:15
-
Benni Mack voted on patch set 2 V +1 CR +1 10/22/21, 13:48
-
Guido Schmechel voted on patch set 2 CR +1 10/23/21, 14:37
-
Stefan Bürk commented on patch set 2 CR -1 10/23/21, 15:08
TypoScriptParser.php:717That 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. -
Sybille Peters commented on patch set 2 10/23/21, 15:14
TypoScriptParser.php:714Isn'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? -
Stefan Bürk commented on patch set 2 10/23/21, 15:17
TypoScriptParser.php:714ReplySee 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. -
Stefan Bürk uploaded patch set 3 10/23/21, 16:18
-
Stefan Bürk uploaded patch set 4 10/23/21, 16:19
-
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
-
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
-
Oliver Klee wrote 10/23/21, 16:47
Removed reviewer Oliver Klee. -
Stefan Bürk voted on patch set 4 V +1 CR +1 10/23/21, 18:20
-
Christian Kuhn commented on patch set 4 10/23/21, 18:24
Reply
DoneTypoScriptParser.php:714ReplyDone -
Stefan Bürk commented on patch set 4 10/23/21, 18:25
TypoScriptParser.php:717ReplyDone -
Christian Kuhn voted on patch set 4 V +2 CR +2 10/23/21, 18:26
-
Christian Kuhn merged patch set 5 10/23/21, 18:26