93512[BUGFIX] Avoid using null as array offset
Commit message
Review
-
Code review CR +2 Done
- Stefan Bürk +2
- Garvin Hicking +1
-
Verified V +2 Done
- Stefan Bürk +2
- Garvin Hicking +1
- core-ci +1 CI
Issues 1
Files 5
- typo3/sysext/backend/Classes/Form/FormDataProvider/DatabaseRowDefaultAsReadonly.php4+7 −4
- typo3/sysext/backend/Classes/Utility/BackendUtility.php2+1 −1
- typo3/sysext/core/Classes/Http/Client/GuzzleClientFactory.php+8 −6
- typo3/sysext/frontend/Classes/ContentObject/ContentObjectRenderer.php11+2 −1
- typo3/sysext/impexp/Classes/ImportExport.php2+3 −2
Review log 2734
Show 89 earlier messages
-
Markus Klein uploaded patch set 1 04/01/26, 12:44
-
Oliver Klee voted on patch set 1 CR +1 04/01/26, 12:45
-
core-ci voted on patch set 1 V +1 04/01/26, 12:54 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/99401
-
Garvin Hicking commented on patch set 1 04/01/26, 19:34
Did you find the instances manually or with some automatted check/rule? -
Markus Klein commented on patch set 1 04/01/26, 19:40
Reply
I found one of them in the logs (due to some playing around with my settings) and the rest with a simple search for "null]" ;-) -
Garvin Hicking commented on patch set 1 04/02/26, 08:17
DatabaseRowDefaultAsReadonly.php:45I think this changes the intention. Now we check for a $result['databaseRow'][0] offset, and under some circumstances maybe that "0" could be filled. I think the whole condition would need to be refactored to check the array only in case a languageField is set. Or we would need to utilize a string like `__loremImpsumThisWillNeverHappenIAmSureOfIt` 😄BackendUtility.php:2243same here, checking for $MOD_MENU[$key][0] might access something in case we might have "0" as a valid key?ContentObjectRenderer.php:1567This is easier to showcase what I would write: ```suggestion if (isset($conf['fieldRequired'] ?? null) && !trim($this->data[$conf['fieldRequired']] ?? '')) { ``` -
Markus Klein commented on patch set 1 CR -1 04/02/26, 11:17
Yes, this was just an idea, maybe it's really better to go with proper conditions; I'll quickly update this -
Markus Klein uploaded patch set 2
CR +1V +104/02/26, 13:41 -
Markus Klein commented on patch set 2 04/02/26, 13:41
DatabaseRowDefaultAsReadonly.php:45ReplyDoneBackendUtility.php:2243ReplyDoneContentObjectRenderer.php:1567ReplyDone
-
Oliver Klee commented on patch set 2 04/02/26, 13:52
DatabaseRowDefaultAsReadonly.php:47Those are strings, not booleans. So let's make these checks more explicit by using `=== ''`.ContentObjectRenderer.php:1568```suggestion if ($fieldName !== '' && trim($this->data[$fieldName] ?? '') !== '') { ```ImportExport.php:658Let's make this check more explicit as well. -
core-ci voted on patch set 2 V +1 04/02/26, 13:57 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/99494
-
Markus Klein uploaded patch set 3
V +104/02/26, 14:07 -
Markus Klein commented on patch set 2 04/02/26, 14:07
DatabaseRowDefaultAsReadonly.php:47ReplyDoneContentObjectRenderer.php:1568ReplyDoneImportExport.php:658ReplyDone -
Oliver Klee commented on patch set 3 04/02/26, 14:08
ContentObjectRenderer.php:1568```suggestion if ($fieldName !== '' && trim($this->data[$fieldName] ?? '') !== '') { ``` -
core-ci voted on patch set 3 V +1 04/02/26, 14:18 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/99501
-
Stefan Bürk commented on patch set 4
V +104/02/26, 20:55Published edit on patch set 3. -
Stefan Bürk commented on patch set 4 04/02/26, 20:56
ContentObjectRenderer.php:1568ReplyFix applied. -
core-ci voted on patch set 4 V -1 04/02/26, 21:09 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/99524
-
Stefan Bürk commented on patch set 4 04/02/26, 21:26
ContentObjectRenderer.php:1568ReplyShould have been `=== ''` instead of `!== ''`. However, now it's really interessting if the original check and behavor was really intented that way or not. Was it about ensuring that a value is set, which would mean `=== ''` is corred but not the failing test assumptions, or these assumption are right and needs to be `!== ''` here .....` (glad we applied it so it revealed that the orignal check was possible not that obvious as I/we possible has thought). See: https://3v4l.org/H1jsh -
Markus Klein commented on patch set 4 04/03/26, 10:25
ContentObjectRenderer.php:1568ReplyThe logic has to be: * if a "fieldRequired" is configured => check if a value is supplied * otherwise, do nothing -
Markus Klein commented on patch set 4 CR -1 04/03/26, 10:42
Looking into it now -
Markus Klein uploaded patch set 5
CR -1V -104/03/26, 10:57 -
Markus Klein commented on patch set 5 04/03/26, 10:58
ContentObjectRenderer.php:1568ReplyDone -
core-ci voted on patch set 5 V -1 04/03/26, 11:11 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/99568
-
Markus Klein commented on patch set 5 04/03/26, 14:36
OpContentObjectRenderer.php:1568Opinions wanted. The function comment says "when there is no content in the field given by fieldRequired" Until now, any false-ish field value ('', 0) has been treated as "no content". With our current implementation a "0" value will now be treated as "has content". Since I assume we really do not want to have a hidden breaking change here, I'd suggest to go back to the old boolean-operator. -
Markus Klein uploaded patch set 6
V -104/03/26, 14:41 -
core-ci voted on patch set 6 V +1 04/03/26, 14:50 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/99578
-
Markus Klein uploaded patch set 7
V +104/09/26, 13:52 -
Markus Klein commented on patch set 7 04/09/26, 13:52
ContentObjectRenderer.php:1568ReplyDone -
core-ci voted on patch set 7 V +1 04/09/26, 14:01 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/99856
-
Stefan Bürk voted on patch set 7 CR +1 V +1 04/09/26, 14:40
-
Garvin Hicking voted on patch set 7 CR +1 V +1 04/09/26, 15:41
-
Stefan Bürk voted on patch set 7 CR +2 V +2 04/09/26, 18:35
-
Stefan Bürk merged patch set 8 04/09/26, 18:36