Review main Ready for review Stale

94798[BUGFIX] Persist nullable selectSingle changes between NULL and 0

Garvin Hicking CR +1 V +1 Normal +153 −4 updated 09/03/26, 08:05

Commit message

A "type=select" "renderType=selectSingle" field configured with
"nullable" => true and an item list containing the value 0 did not
persist a change from NULL to 0 or from 0 to NULL. All other value
transitions worked.

`StaticSelectFieldType::isNullable()` was hardcoded to return false,
ignoring the "nullable" TCA configuration. As a result,
DataHandler::compareFieldArrayWithCurrentAndUnset() treated the field
as non-nullable and compared submitted and stored values with an
integer cast, where (int)null === (int)0 evaluates to true. The change
was therefore considered a no-op and silently dropped.

StaticSelectFieldType now honors the "nullable" configuration via
AbstractFieldType::isNullable(), so NULL and the valid item value 0 are
kept distinct.

Test this change

Run a command in your clone of the TYPO3 Core. Then try what the change does and vote on Verified in Gerrit. How to review a patch

Check out patch set 3
git fetch https://review.typo3.org/Packages/TYPO3.CMS refs/changes/98/94798/3 && git checkout FETCH_HEAD
Cherry-pick onto main
git fetch https://review.typo3.org/Packages/TYPO3.CMS refs/changes/98/94798/3 && git cherry-pick FETCH_HEAD

Review

  • Code review CR +1 Needs a vote
    • Oliver Klee +1
  • Verified V +1 Needs a vote
    • Oliver Klee +1
    • core-ci +1 CI

Relation chain 2

  1. main 94801[BUGFIX] Prevent multiple identifier quoting in new Extbase QoM methods Based on this change Merged Garvin Hicking CR +2 V +2 → 14.3 Normal +36 −22

    The chain has patch set 2 of 3, the changes above it need a rebase.

  2. 94798 [BUGFIX] Persist nullable selectSingle changes between NULL and 0 This change

Issues 2

Files 5

Review log 912

  1. Garvin Hicking uploaded patch set 1 07/16/26, 10:45

  2. Garvin Hicking updated the commit message in patch set 2 07/16/26, 10:47

  3. core-ci voted on patch set 1 V +1 07/16/26, 10:54 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/104829

  4. core-ci voted on patch set 2 V +1 07/16/26, 10:55 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/104830

  5. Josua Vogel voted on patch set 2 CR +1 09/03/26, 05:42

  6. Garvin Hicking updated the commit message in patch set 3 CR +1 V +1 09/03/26, 06:11

  7. Garvin Hicking commented on patch set 3 09/03/26, 06:12

    Unresolved

    Checking out #106122 a lot of these contain hardcoded nullable attributes. I think these need revisiting? Thoughts? Followup or here?
  8. core-ci voted on patch set 3 V +1 09/03/26, 06:19 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/107719

  9. Oliver Klee voted on patch set 3 V +1 09/03/26, 06:50

  10. Oliver Klee voted on patch set 3 CR +1 09/03/26, 06:50

  11. Daniel Windloff commented on patch set 3 09/03/26, 07:58

    Hey, some remarks: - The implementation is missing the FormEngine component for strings—specifically (items with string values are allowed). A quick test shows that this isn't handled in the configuration. From the perspective of FormEngine and DataHandler, the functionality therefore remains incomplete. Use this configuration for example: 'select_single_nullable_string' => [ 'exclude' => false, 'label' => 'select single nullable', 'config' => [ 'type' => 'select', 'renderType' => 'selectSingle', 'minitems' => 1, 'maxitems' => 1, 'nullable' => true, 'default' => null, 'items' => [ ['label' => 'null', 'value' => null], ['label' => 'Regular empty string', 'value' => ''], ['label' => 'Member', 'value' => 'value1'], ['label' => 'Special', 'value' => 'value2'], ], ], ], - I find implementing this for only a subset of the `select` type problematic, as it creates the expectation that it will work for all `select` configurations. In my point of view, a cleaner approach would be a new TCA config type like `selectFromList` that selects exclusively from an `items` list containing `int|null` values ​​and supports null. With the current version, it is difficult to document when it works and when not. - To me, this isn't a bugfix. It is a feature. Nullable option hasn't been implemented for the `select` type as far as I know.
  12. Garvin Hicking commented on patch set 3 09/03/26, 08:05

    Reply Unresolved

    Hey Daniel, thanks a lot, that is very good input. I'll need to chew on it. I wouldn't like adding a new TCA type for it though, so "fixing" it in every type=select case would be better for integrators. You're probably right on declaring it a missing feature, which would rule out the backport(s).