Review main Abandoned

91004[WIP][BUGFIX] Avoid assuming custom property type is a relation

Stefan Bürk CR 0 V 0 Easy +21 −2 updated 09/02/26, 20:18

Commit message

Extbase supports custom classes as property types, generic
implementation or based on `TypeInterface` with additional
feature.

During old non-namespace times the extbase columnmap creation
has been changed to determine the type of relations based on
property annotations with a `strpos()` call to check [1] for
class names (non-namespaced), which has been later replaced
with a `strpbrk()` call, which is even harder to understand
and commented as such because the one or other developer hit
their feet on that stone without getting behind it.

It's a common practice in project to implement custom types,
mostly based on `TypeInterface`, for example to implement a
json encode/decode behavior to custom types from a string
value. Currently, `HAS_ONE` relation type is set for column
even if no relation table is configured, making no sense as
a relation requires a target (table).

Having `HAS_ONE` set without a table configured leads to the
weird behaviour in extbase `Backend` when persisting new
domain models. For new models `Backend::insertObject()` is
called first and `persistObject()` afterwards on the same
object. `insertObject()` sets the value to persist to the
hardcoded value `(int) 0` in case `HAS_ONE` relation has
been determined while the `persistObject()` may set correct
value (json array string) later on and leading to database
corruption in case non-array values are not expected for the
field and "persistObject()" fails after db record has been
created with `(int)0` instead of the correct value to persist.

This change modifies the place to set `HAS_ONE` only when a
relation table has been determined to avoid setting `HAS_ONE`
for all (text/json) fields.

Hard to debug and even harder to create a test for it.

[1] https://github.com/typo3/typo3/commit/5eed09d81dfc2943d4ca1699684cc533b1c686ef

Review

  • Code review CR 0
  • Verified V 0
    • core-ci +1 CI

Files 1

Review log 1323

  1. Stefan Bürk uploaded patch set 1 10/10/25, 17:27

  2. core-ci voted on patch set 1 V -1 10/10/25, 17:46 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/86428

  3. Oliver Klee updated the commit message in patch set 2 V -1 10/10/25, 17:58

  4. core-ci voted on patch set 2 V -1 10/10/25, 18:08 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/86433

  5. Stefan Bürk uploaded patch set 3 V -1 10/10/25, 19:03

  6. core-ci voted on patch set 3 V -1 10/10/25, 19:13 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/86434

  7. Stefan Bürk uploaded patch set 4 V -1 10/10/25, 19:24

  8. Stefan Bürk marked it work in progress 10/10/25, 19:26

  9. core-ci voted on patch set 4 V +1 10/10/25, 19:31 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/86435

  10. Stefan Bürk rebased onto patch set 5 V +1 10/11/25, 16:12

  11. core-ci voted on patch set 5 V +1 10/11/25, 16:26 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/86471

  12. Stefan Bürk uploaded patch set 6 V +1 10/12/25, 11:19

  13. core-ci voted on patch set 6 V +1 10/12/25, 11:29 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/86490

  14. Stefan Bürk rebased onto patch set 7 V +1 10/13/25, 10:04

  15. core-ci voted on patch set 7 V +1 10/13/25, 10:18 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/86528

  16. Stefan Bürk rebased onto patch set 8 V +1 10/16/25, 07:45

  17. core-ci voted on patch set 8 V +1 10/16/25, 08:00 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/86791

  18. Stefan Bürk rebased onto patch set 9 V +1 11/10/25, 12:30

  19. core-ci voted on patch set 9 V +1 11/10/25, 12:46 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/88844

  20. Stefan Bürk rebased onto patch set 10 V +1 05/28/26, 14:01

  21. core-ci voted on patch set 10 V +1 05/28/26, 14:40 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/102548

  22. Garvin Hicking commented on patch set 10 07/16/26, 10:20

    please check out this: 94797: [BUGFIX] Persist nullable native enum properties as NULL in Extbase | https://review.typo3.org/c/Packages/TYPO3.CMS/+/94797 Maybe your more general solution could be preferrable to "just" ENUM-locking. At least we could use the tests and fixtures from there?!
  23. Stefan Bürk abandoned the change 09/02/26, 20:18

    in favour of 94797: [BUGFIX] Do not map value types as Extbase relations | https://review.typo3.org/c/Packages/TYPO3.CMS/+/94797