89294[TASK] Evaluate item value only once in fieldMap Element
Commit message
Review
-
Code review CR +2 Done
- Oli Bartsch +2
- Stefan Bürk +1
- Sven Liebert +1
-
Verified V +2 Done
- Oli Bartsch +2
- Stefan Bürk +1
- Sven Liebert +1
- core-ci +1 CI
Issues 1
Files 1
Review log 1821
-
Oli Bartsch uploaded patch set 1 05/04/25, 21:04
-
core-ci voted on patch set 1 V +1 05/04/25, 21:10 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/78497
-
Stefan Bürk commented on patch set 1 05/04/25, 22:32
FieldMapElement.php:62```suggestion $fieldValue = $itemValueIsArray && isset($itemValue[$fieldName]) ? htmlspecialchars((string)$itemValue[$fieldName]) : ''; ``` -
Stefan Bürk commented on patch set 1 05/04/25, 22:43
FieldMapElement.php:62ReplyAlternativly, we can make the check before the condition in L56 and set `$itemValue` to an empty array in case it is not an array and have an array ensured that way. -
Oli Bartsch uploaded patch set 2
V +105/05/25, 10:19 -
Oli Bartsch commented on patch set 2 05/05/25, 10:20
FieldMapElement.php:56ReplyYou are totally right, thank you! I've adjusted according to your suggestion.FieldMapElement.php:62ReplyDone -
core-ci voted on patch set 2 V +1 05/05/25, 10:29 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/78517
-
Stefan Bürk voted on patch set 2 CR +1 V +1 05/05/25, 13:06
-
Stefan Bürk commented on patch set 2 05/05/25, 13:14
FieldMapElement.php:62ReplyThanks for adopting. -
Sven Liebert voted on patch set 2 CR +1 V +1 05/05/25, 20:43
-
Benjamin Franzke commented on patch set 2 CR -1 05/05/25, 20:46
FieldMapElement.php:57This creates an unnecessary empty array. This array is only used as a fallback and therefore wastes RAM. Why not a fallback to `null`? -
Oli Bartsch commented on patch set 2 05/05/25, 20:56
FieldMapElement.php:57ReplyThis isn't RAM wastage—it's clarity. The variable is meant to be an array. Falling back to null just to save 0.0000012 MB of memory sounds like optimizing the air resistance on a parked car. Besides: [] makes the intent explicit → This is an array, even when it’s empty. It avoids unnecessary if(is_array($itemValue)) spaghetti later. It keeps the code consistent and prevents surprises for the next dev (which could be Future You™). Most importantly: empty arrays don’t break loops. Null does. That’s a pretty harsh way to save a byte. So yes, we're allocating an empty array—for performance, readability, and because our dignity as developers demands it. -
Benjamin Franzke commented on patch set 2 05/06/25, 09:26
FieldMapElement.php:57Reply> It avoids unnecessary if(is_array($itemValue)) spaghetti later. `is_array()` is not needed, since you can call `isset(…['foo'])` on `null`. -
Oli Bartsch commented on patch set 2 05/06/25, 10:08
FieldMapElement.php:57ReplySure, but $itemValue is expected to be an array in this element. We should therefore IMO not do type changes on runtime as that makes following the code harder. Btw. I'm pleased to admit that this is not a no brainer. -
Oli Bartsch commented on patch set 2 05/08/25, 14:22
FieldMapElement.php:57ReplyDone -
Oli Bartsch rebased onto patch set 3
CR +1V +105/12/25, 13:56 -
core-ci voted on patch set 3 V +1 05/12/25, 14:02 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/78804
-
Stefan Bürk voted on patch set 3 CR +1 V +1 05/13/25, 07:33
-
Sven Liebert voted on patch set 3 CR +1 V +1 05/13/25, 07:48
-
Oli Bartsch voted on patch set 3 CR +2 V +2 05/13/25, 07:57
-
Oli Bartsch merged patch set 4 05/13/25, 07:57
FieldMapElement.php:56