Review main Merged

74414[BUGFIX] Prevent undefined array key warnings in PageRenderer

Oli Bartsch CR +2 V +2 Easy +13 −13 updated 04/26/22, 18:20

Commit message

Since JS and CSS related properties might be
modified by hooks, corresponding array access
is now secured using null coalescing operators.
This was actually already done for the majority
of those places.

Note: Some places might not make sense to
fallback, e.g. empty css code or empty JS
file paths. However, this should be handled
in a separate patch, and for main only.

Review

  • Code review CR +2 Done
    • Oli Bartsch +2
    • Oliver Klee +1
    • Stefan Bürk +1
    • Simon Schaufelberger +1
  • Verified V +2 Done
    • Oli Bartsch +2
    • Stefan Bürk +1
    • Simon Schaufelberger +1
    • core-ci +1 CI

Issues 1

Files 1

Review log 1315

  1. Oli Bartsch uploaded patch set 1 04/25/22, 22:39

  2. Oli Bartsch rebased onto patch set 2 04/25/22, 22:39

  3. core-ci voted on patch set 1 V +1 04/25/22, 22:53 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/26436

  4. core-ci voted on patch set 2 V +1 04/25/22, 22:54 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/26437

  5. Simon Schaufelberger commented on patch set 2 CR -1 04/26/22, 00:08

    PageRenderer.php:2213

    shouldn't this be an empty string instead of false?
  6. Oli Bartsch commented on patch set 2 04/26/22, 00:16

    PageRenderer.php:2213 Reply

    Both options will be evaluated to false and therefore fall back to '|'. false makes this more clear and easier to read. It‘s furthermore consistent with the other places in this class, where the same check is in place. So Short answer: No, using false is intended here.
  7. Simon Schaufelberger voted on patch set 2 V +1 CR +1 04/26/22, 09:29

  8. Oliver Klee commented on patch set 2 04/26/22, 10:33

    PageRenderer.php:2213 Reply

    I find it hard to wrap my head around this nested ?? ?: construct. I propose using a local variable and splitting this line up into two statements.
  9. Oliver Klee commented on patch set 2 04/26/22, 10:45

    PageRenderer.php:2757

    Ditto. I propose moving the title to a local variable (which will also reduce duplication).
  10. Oliver Klee commented on patch set 2 04/26/22, 10:59

    @Oliver Should I take care of the changes?
  11. Oli Bartsch commented on patch set 2 04/26/22, 11:36

    Reply

    I agree on those changes but would prefer to do them in a separate patch. As mentioned in my other comment, the exact same code construct is used multiple times in this class. For consistency reasons, we should then adjust all those places accordingly.

    PageRenderer.php:2757 Reply

    Agree, but for the mentioned reasons, let's do this in a separate patch.
  12. Oliver Klee commented on patch set 2 CR +1 04/26/22, 11:43

    Reply

    Ack

    PageRenderer.php:2757 Reply

    Ack
  13. Stefan Bürk voted on patch set 2 V +1 CR +1 04/26/22, 17:46

  14. Oli Bartsch voted on patch set 2 V +2 CR +2 04/26/22, 18:20

  15. Oli Bartsch merged patch set 3 04/26/22, 18:20