Review main Merged

86301[BUGFIX] Handle all possible record values for json field types

Oli Bartsch CR +2 V +2 Normal +80 −6 updated 09/25/24, 06:25

Commit message

Prevent a TypeError since `convertToPHPValue` might return all
of the basic PHP data types as the result of json_decode.

Review

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

Issues 1

Files 2

Review log 1418

  1. Oli Bartsch uploaded patch set 1 09/24/24, 15:18

  2. core-ci voted on patch set 1 V +1 09/24/24, 15:31 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/66506

  3. Garvin Hicking commented on patch set 1 09/24/24, 15:40

    Would we maybe wanto to throw an exception or log errors when this occurs in "real life"?
  4. Nikita Hovratov commented on patch set 1 CR -1 09/24/24, 15:49

  5. Benjamin Franzke uploaded patch set 2 CR -1 V +1 09/24/24, 17:20

  6. Benjamin Franzke commented on patch set 2 09/24/24, 17:20

    This is hard to test since https://forge.typo3.org/issues/105004 is still not resolved. But we should merge anyway.

    Reply

    ack.
  7. core-ci voted on patch set 2 V +1 09/24/24, 17:26 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/66512

  8. Benjamin Franzke commented on patch set 2 09/24/24, 17:28

    Reply

    vendor/doctrine/dbal/src/Types/JsonType.php uses JSON_THROW_ON_ERROR and then generates `ValueNotConvertible`, which is then transformed into `RecordPropertyException` by typo3/sysext/core/Classes/Domain/Record.php. (we can not really test that easily right now, since we test the record field transformer directly instead of testing via RecordFactory (which I'd prefer, anyway, that's offtopic). As nikita correctly said, `null` is a valid json_decode result, so we should pass that through, therefore marking done.
  9. Benjamin Franzke updated the commit message in patch set 3 CR +1 V +1 09/24/24, 19:02

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

  11. Oli Bartsch uploaded patch set 4 CR +1 V +1 09/24/24, 20:02

  12. Oli Bartsch commented on patch set 4 09/24/24, 20:03

    Reply

    I added a test which shows that `RecordPropertyException` is thrown for an invalid JSON value.
  13. core-ci voted on patch set 4 V +1 09/24/24, 20:08 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/66521

  14. Garvin Hicking commented on patch set 4 CR +1 09/24/24, 20:19

    Reply

    I like that, much appreciated (and thanks benjamin for the explanation)
  15. Benjamin Franzke voted on patch set 4 CR +1 V +1 09/25/24, 05:14

  16. Benni Mack voted on patch set 4 CR +1 V +1 09/25/24, 05:16

  17. Benjamin Franzke commented on patch set 4 CR +2 V +2 09/25/24, 06:25

    Tested again content-blocks main, the nightly error disappeared.
  18. Benjamin Franzke merged patch set 5 09/25/24, 06:25