Review 14.3 Merged

95602[BUGFIX] Normalize empty relation values for integer columns

Benni Mack CR +2 V +2 Normal +155 −0 updated 09/03/26, 13:04

Commit message

A relation field - typically a "group" field with maxitems=1, no
MM table and a single foreign table - may be stored in an integer
database column. Creating a workspace version recalculates the
relation, which yields an empty string when no relation is set.

DataHandler passed that empty string on unchanged. The SQL write
itself survives it, because Connection::insert() and update()
bind values with the type derived from the database schema. The
very same field array is handed to RecordHistoryStore though, so
sys_history recorded "" instead of 0 for such a field.

insertUpdateDB_preprocessBasedOnFieldType() now turns an empty
string into 0 whenever the target column is of type integer. That
is the only place in the write path knowing both the value and
the column type: TCA alone does not, since a group column is
created as TEXT unless an extension declares it as integer in
ext_tables.sql.

Functional tests cover the sanitization itself and the workspace
versioning of both an empty and a filled relation field.

Review

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

Issues 1

Files 5

Review log 34

  1. Benni Mack commented on patch set 1 09/03/26, 12:42

    Cherry Picked from branch main.
  2. core-ci voted on patch set 1 V +1 09/03/26, 12:52 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/107751

  3. Benni Mack voted on patch set 1 CR +2 V +2 09/03/26, 13:04

  4. Benni Mack merged patch set 2 09/03/26, 13:04