82518[BUGFIX] Avoid using null as array key in RecordStateFactory
Commit message
Review
-
Code review CR 0
-
Verified V 0
Issues 2
Files 1
Review log 79
-
Oliver Klee uploaded patch set 1 01/19/24, 12:45
-
Oliver Klee updated the commit message in patch set 2 01/19/24, 12:46
-
core-ci voted on patch set 1 V +1 01/19/24, 12:51 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/51814
-
Andreas Kienast commented on patch set 2 01/19/24, 12:52
I don't understand what bug is fixed here. AFAICS, the key will never be null anyway thanks to the `int` cast? -
core-ci voted on patch set 2 V +1 01/19/24, 12:54 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/51815
-
Oliver Klee commented on patch set 2 01/19/24, 12:57
Reply
The `int` cast is on the array values after accessing the array using the `string|null` keys that are provided as array values by `resolveAspectFieldNames`. On line 75, you can see that those can be `null`. -
Andreas Kienast commented on patch set 2 01/19/24, 13:07
Reply
Just to clarify this: is there an actual bug that breaks things, or is this change purely cosmetical? I'm still under the impression that the `int` case in combination with the null coalesce operator is "safe enough", the latter is used in various places in cases where the key could be `null`. -
Oliver Klee commented on patch set 2 CR -1 01/19/24, 13:19
I just checked: This change indeed is not necessary as `null` array keys are auto-converted to empty strings (which is valid). https://www.php.net/manual/language.types.array.phpReply Unresolved
This is an actual bug. It got visible when I added native type declarations to the array_map in `resolveAspectFieldNames` in https://review.typo3.org/c/Packages/TYPO3.CMS/+/82281. I think we still have a misunderstanding here (judging by your message). I'll try my best to clear it up. :-) This is what happens without the change: 1. in `resolveAspectFieldValues`, an array of `string|null` is passed 2. in the ano -
Oliver Klee abandoned the change 01/19/24, 13:19