Review main Merged

73176[BUGFIX] Fix undefined key warning in ElementInformationController

Robert Kärner CR +2 V +2 Easy +1 −1 updated 01/28/22, 13:41

Commit message

Since the element information window can also be opened from
an IRRE within a Flexform element, the table name might be
empty and a fallback has to be added when accessing TCA.

Review

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

Issues 1

Files 1

Review log 1415

  1. Robert Kärner uploaded patch set 1 01/26/22, 10:04

  2. core-ci voted on patch set 1 V +1 01/26/22, 10:14 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/22558

  3. Oliver Klee commented on patch set 1 01/26/22, 10:52

    ElementInformationController.php:708

    I'm not sure it makes sense to call ->sL with an empty string. Maybe use a condition to check if the title is set?
  4. Oli Bartsch voted on patch set 1 V +1 CR +1 01/26/22, 12:41

  5. Benni Mack commented on patch set 1 01/27/22, 19:57

    ElementInformationController.php:708 Reply

    Care to update, Oli?
  6. Robert Kärner commented on patch set 1 01/28/22, 11:01

    ElementInformationController.php:708 Reply

    I'll take care of it. Sorry, slipped out of my view.
  7. Oliver Klee commented on patch set 1 01/28/22, 11:21

    Thanks, Robert!
  8. Oli Bartsch commented on patch set 1 01/28/22, 11:41

    ElementInformationController.php:708 Reply

    IMO this makes the fix unnecessary complicated. Passing an empty string to ->sL() will just return an empty string and the fallback is used. We use it this way at 100+ places in Core. Also think about $GLOBALS['TCA'][$row['tablename']]['ctrl']['title'] not being empty but referencing a non existing label. We would then still need the fallback for this result again.
  9. Stefan Bürk commented on patch set 1 01/28/22, 11:44

    ElementInformationController.php:708 Reply

    I would suggest to add a check and early return in 'sl()' if provided input is empty in a dedicated patch, avoiding runtime cache and looking up in the language files, instead of making these places gluttered and complex with checks, like Oliver mentioned.
  10. Stefan Bürk commented on patch set 1 V +1 CR +1 01/28/22, 11:58

    ElementInformationController.php:708 Reply

  11. Robert Kärner commented on patch set 1 01/28/22, 12:30

    ElementInformationController.php:708 Reply

    Sounds good to me, this will make things much easier. I think we can resolve this comment once #73189 has been merged.
  12. Oliver Klee voted on patch set 1 CR +1 01/28/22, 12:55

  13. Robert Kärner commented on patch set 1 01/28/22, 13:20

    ElementInformationController.php:708 Reply

    Done
  14. Oli Bartsch voted on patch set 1 V +2 CR +2 01/28/22, 13:41

  15. Oli Bartsch merged patch set 2 01/28/22, 13:41