Review main Merged

87011[BUGFIX] Handle db value null in AbstractItemProvider

Nikita Hovratov CR +2 V +2 Easy +43 −0 updated 11/22/24, 07:23

Commit message

While "item-able" field types do not support null values
in the backend, it is still possible null was added via
external API (e.g. extbase).

A guard clause is added for null and will return an empty
array if encountered. This is now needed, as GU:trimExplode
is strict since TYPO3 v13.

In future, it could be considered to introduce option `nullable`
for these field types as well. This would be especially useful
for optional relations and would erase the need to define a
default item like "Please select...".

Review

  • Code review CR +2 Done
    • Benni Mack +2
    • Garvin Hicking +1
    • Simon Schaufelberger +1
  • Verified V +2 Done
    • Benni Mack +2
    • Garvin Hicking +1
    • Simon Schaufelberger +1
    • core-ci +1 CI

Issues 2

Files 2

Review log 910

  1. Nikita Hovratov uploaded patch set 1 11/18/24, 10:45

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

  3. Garvin Hicking commented on patch set 1 11/18/24, 21:47

    I think I've seen a similar issue with this in some TCA types; usually they were recommended to be fixed by setting a "default" TCA entry and setting it to an empty string. Would that help in this case?
  4. Nikita Hovratov commented on patch set 1 11/18/24, 22:41

    Reply

    I totally could change my code, but the aim was to fix the side effect of the breaking change. Just for bw compat.
  5. Garvin Hicking commented on patch set 1 11/18/24, 23:07

    Reply

    Sorry I expressed this wrong: I wanted to ask if we should try to see what other TCA types might need handling of nullable fields too, or if this only affects 'items' cases. But can be done with followups, it just came to my mind.
  6. Nikita Hovratov commented on patch set 1 11/19/24, 07:37

    Reply

    Ah ok, then I misunderstood that. Yeah, let's do it one by one if another case appears. This will fix select, radio and check already. Not sure if there are other types with DataProviders, which use trimExplode/intExplode on nullable values. It's not so much in use actually (I mean the nullable checkbox feature).
  7. Garvin Hicking commented on patch set 1 CR +1 V +1 11/19/24, 17:37

    Reply

    works for me
  8. Simon Schaufelberger voted on patch set 1 CR +1 V +1 11/21/24, 21:37

  9. Benni Mack voted on patch set 1 CR +2 V +2 11/22/24, 07:22

  10. Benni Mack merged patch set 2 11/22/24, 07:23