Review main Merged

82794[BUGFIX] Mitigate a TypeError in `StandardContentPreviewRenderer`

Stefan Bürk CR +2 V +2 Easy +1 −1 updated 02/09/24, 22:19

Commit message

An editor can trigger a TypeError exception leading to a 503 error
message `trim() expects parameter 1 to be string, null given` in
the backend page module by creating `menu_categorized_content`
objects with `selected_categories` and then turning them into
`menu_section` objects.

This change mitigates the type error by using a null-coalesce
fallback passing an invalid type to the `trim()` method in
`StandardContentPreviewRenderer::generateListForMenuContentTypes()`.

Review

  • Code review CR +2 Done
    • Stefan Bürk +2
    • Benjamin Franzke +1
    • Oli Bartsch +1
    • Oliver Klee +1
    • Christian Kuhn +1
  • Verified V +2 Done
    • Stefan Bürk +2
    • Benjamin Franzke +1
    • Oli Bartsch +1
    • Christian Kuhn +1
    • core-ci +1 CI

Issues 1

Files 1

Review log 2025

  1. Stefan Bürk uploaded patch set 1 02/05/24, 16:14

  2. core-ci voted on patch set 1 V +1 02/05/24, 16:20 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/52744

  3. Oliver Klee voted on patch set 1 CR +1 02/05/24, 17:44

  4. Benjamin Franzke commented on patch set 1 CR -1 02/06/24, 05:11

    StandardContentPreviewRenderer.php:338

    You know, I don't like uncertainty in code, and this cast looks to be that, as null coalescing operator is sufficient by itself… The commit message states the issue we're facing is a `null` value, then we should not additionally need to cast to string, but only do`$record[$field] ?? ''`. The code now reads like "we don't know anything, maybe we even receive integers?" Or do we? If so, let's name that in the commit message, otherwise let's drop the unneeded typecast.
  5. Simon Schaufelberger commented on patch set 1 02/06/24, 07:03

    An editor
  6. Stefan Bürk uploaded patch set 2 CR +1 V +1 02/06/24, 08:35

  7. Stefan Bürk updated the commit message in patch set 3 02/06/24, 08:37

  8. Stefan Bürk commented on patch set 3 02/06/24, 08:37

    Reply

    Done

    StandardContentPreviewRenderer.php:338 Reply

    Done
  9. core-ci voted on patch set 2 V +1 02/06/24, 08:40 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/52758

  10. core-ci voted on patch set 3 V +1 02/06/24, 08:43 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/52760

  11. Oli Bartsch commented on patch set 3 02/06/24, 14:49

    StandardContentPreviewRenderer.php:338

    Why do we remove the `trim()`? This seems like a change in behaviour.
  12. Stefan Bürk commented on patch set 4 V +1 02/06/24, 16:21

    Published edit on patch set 3.
  13. Stefan Bürk commented on patch set 4 02/06/24, 16:22

    StandardContentPreviewRenderer.php:338 Reply

    unitended - was the "revert" back related to comment from Benjamin.
  14. Oliver Klee voted on patch set 4 CR +1 02/06/24, 16:24

  15. Oli Bartsch commented on patch set 4 02/06/24, 16:25

    Could the commit message also be updated as there is no more string cast done?
  16. Stefan Bürk updated the commit message in patch set 5 CR +1 02/06/24, 16:27

  17. core-ci voted on patch set 4 V +1 02/06/24, 16:27 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/52802

  18. Stefan Bürk commented on patch set 5 02/06/24, 16:27

    Reply

    Done
  19. core-ci voted on patch set 5 V +1 02/06/24, 16:33 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/52803

  20. Oliver Klee voted on patch set 5 CR +1 02/06/24, 16:38

  21. Benjamin Franzke voted on patch set 5 CR +1 V +1 02/09/24, 12:23

  22. Christian Kuhn voted on patch set 5 CR +1 V +1 02/09/24, 12:28

  23. Oli Bartsch voted on patch set 5 CR +1 V +1 02/09/24, 17:37

  24. Stefan Bürk voted on patch set 5 CR +2 V +2 02/09/24, 21:59

  25. Stefan Bürk merged patch set 6 02/09/24, 22:19