Review main Merged

73899[BUGFIX] Avoid undefined array key warnings in PreviewUriBuilder

Francois Suter CR +2 V +2 Easy +3 −3 updated 03/14/22, 12:44

Commit message

In class \TYPO3\CMS\Workspaces\Preview\PreviewUriBuilder the value
for TSconfig option "options.workspaces.previewPageId" is tested for a
syntax like field:value but if the actual value does not use a colon,
it will result in an undefined array key warning.

Review

  • Code review CR +2 Done
    • Benni Mack +2
    • Oli Bartsch +1
    • Oliver Klee +1
  • Verified V +2 Done
    • Benni Mack +2
    • Oli Bartsch +1
    • core-ci +1 CI

Issues 1

Files 1

Review log 1416

  1. Francois Suter uploaded patch set 1 03/11/22, 08:01

  2. Benni Mack commented on patch set 1 V +1 CR +1 03/11/22, 08:05

    Thank you, Francois!
  3. Francois Suter commented on patch set 1 03/11/22, 08:07

    Thanks for the review. A much more complicated patch is coming up ;-)
  4. core-ci voted on patch set 1 V +1 03/11/22, 08:10 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/24826

  5. Jonas Eberle voted on patch set 1 CR +1 03/11/22, 08:51

  6. Oliver Klee voted on patch set 1 CR +1 03/11/22, 08:56

  7. Oli Bartsch commented on patch set 1 03/11/22, 09:26

    PreviewUriBuilder.php:205

    Since we are already on it, should we also add a fallback for the case $previewValueParts[1] does not exist in $liveRecord? Otherwise this would still trigger a warning.
  8. Francois Suter commented on patch set 1 03/14/22, 08:32

    I can see the need for that. The hard part is to define what fallback makes sense. Honestly I don't see any, so my proposal would be to throw an exception in this case. What do you think?

    PreviewUriBuilder.php:205 Reply

    I can see the need for that. The hard part is to define what fallback makes sense. Honestly I don't see any, so my proposal would be to throw an exception in this case. What do you think?
  9. Oli Bartsch commented on patch set 1 03/14/22, 08:56

    PreviewUriBuilder.php:205 Reply

    I would just go with (int)($liveRecord[$previewValueParts[1]] ?? 0)
  10. Francois Suter uploaded patch set 2 03/14/22, 09:49

  11. Francois Suter commented on patch set 2 03/14/22, 09:50

    OK. Done in patchset 2.

    PreviewUriBuilder.php:205 Reply

    Done
  12. core-ci voted on patch set 2 V +1 03/14/22, 09:59 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/24871

  13. Oliver Klee voted on patch set 2 CR +1 03/14/22, 10:37

  14. Oli Bartsch voted on patch set 2 V +1 CR +1 03/14/22, 11:55

  15. Benni Mack voted on patch set 2 V +2 CR +2 03/14/22, 12:44

  16. Benni Mack merged patch set 3 03/14/22, 12:44