Review main Merged

83844[BUGFIX] Check for children in FormEngine container

Oli Bartsch CR +2 V +2 Normal +28 −23 updated 04/19/24, 13:54

Commit message

When resolving the first and last inline
elements in the `FilesControlContainer`
and `InlineControlContainer`, it is now
properly checked, whether any children
exist at all, preventing possible type
errors.

Additionally a fallback is added to
prevent further warnings in the containers
while trying to iterate over the children.

Review

  • Code review CR +2 Done
    • Oli Bartsch +2
    • Marcin Sągol +1
    • Stefan Bürk +1
  • Verified V +2 Done
    • Oli Bartsch +2
    • Marcin Sągol +1
    • Stefan Bürk +1
    • core-ci +1 CI

Issues 1

Files 2

Review log 1721

  1. Oli Bartsch uploaded patch set 1 04/17/24, 09:41

  2. Stefan Bürk voted on patch set 1 CR +1 04/17/24, 09:43

  3. core-ci voted on patch set 1 V +1 04/17/24, 09:46 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/56139

  4. Marcin Sągol commented on patch set 1 V -1 04/17/24, 09:56

    FilesControlContainer.php:149

    The `children` key is checked also in 2 different places in this file. So we either check its existance there, or initialize an empty array if it was not set.

    InlineControlContainer.php:142

    Same here, the `children` is also used in other places in this class so we must handle it there.
  5. Oli Bartsch uploaded patch set 2 CR +1 V +1 04/17/24, 10:04

  6. core-ci voted on patch set 2 V +1 04/17/24, 10:11 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/56145

  7. Marcin Sągol commented on patch set 2 CR +1 V +1 04/17/24, 10:14

    Works fine.
  8. Marcin Sągol commented on patch set 2 04/17/24, 10:14

    FilesControlContainer.php:149 Reply

    Done

    InlineControlContainer.php:142 Reply

    Done
  9. Mathias Brodala commented on patch set 2 04/17/24, 10:48

    while

    FilesControlContainer.php:156

    Notice that end() as well as reset() not only return elements of an array but also modify the internal pointer. Since this can lead to obscure errors I'd personally prefer something like this: $firstChild = $inlineChildren[array_key_first($inlineChildren)] ?? null; $lastChild = $inlineChildren[array_key_last($inlineChildren)] ?? null; This ensures that $inlineChildren is definitely left unchanged.
  10. Oli Bartsch uploaded patch set 3 CR +1 V +1 04/17/24, 19:37

  11. Oli Bartsch commented on patch set 3 04/17/24, 19:37

    Reply

    Done

    FilesControlContainer.php:156 Reply

    Done
  12. core-ci voted on patch set 3 V +1 04/17/24, 19:43 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/56189

  13. Andreas Kienast voted on patch set 3 CR +1 04/18/24, 07:22

  14. Marcin Sągol commented on patch set 3 04/18/24, 08:05

    InlineControlContainer.php:310

    Should we use $inlineChildren variable also here since it was initialized and re-used before?
  15. Oli Bartsch uploaded patch set 4 CR +1 V +1 04/18/24, 08:19

  16. Oli Bartsch commented on patch set 4 04/18/24, 08:20

    InlineControlContainer.php:310 Reply

    Done
  17. Marcin Sągol voted on patch set 4 CR +1 V +1 04/18/24, 08:22

  18. core-ci voted on patch set 4 V +1 04/18/24, 08:29 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/56234

  19. Stefan Bürk voted on patch set 4 CR +1 V +1 04/19/24, 12:28

  20. Oli Bartsch voted on patch set 4 CR +2 V +2 04/19/24, 13:54

  21. Oli Bartsch merged patch set 5 04/19/24, 13:54