Review 14.3 Merged

94903[TASK] Do not rely on Doctrine schema object array keys

Stefan Bürk CR +2 V +2 Easy +33 −2 updated 07/23/26, 12:36

Commit message

`Doctrine\DBAL\Schema\Table` keys columns, indexes and foreign key
constraints by a normalized name of its own - lowercased and with
identifier quotes trimmed. Two places rebuild a `Table` and rely on
those keys to deduplicate the definitions passed to the constructor.

`TableBuilder::addIndex()` merges the new index in using a key built
with `strtolower()` only, while the name originates from
`getQuotedName()`. For a quoted index name the key is `` `myidx` ``
and never matches Doctrine's `myidx`, so re-defining that index does
not replace the previous one and the duplicate is passed on.

`SchemaMigrator::mergeTableDefinitions()` deduplicates foreign keys
through `array_merge()` on the Doctrine keys, while the neighbouring
columns and indexes are already merged explicitly.

Both work today only because the keys happen to line up.
`Table::__construct()` re-derives every key itself, so the passed
keys are discarded anyway and only ever mattered for the merge.

Both places now merge explicitly by the object name, mirroring the
existing `mergeColumns()` and `mergeIndexes()`, which also fixes the
quoted index name case.

Note that Doctrine generates a name for unnamed foreign key
constraints as array key only, never on the constraint itself, so
`getName()` stays empty. Merging those by name would collapse them
into one, therefore they are kept as they are.

No behaviour change for existing definitions, no new Doctrine DBAL
API used.

Review

  • Code review CR +2 Done
    • Stefan Bürk +2
  • Verified V +2 Done
    • Stefan Bürk +2
    • core-ci +1 CI

Issues 2

Files 2

Review log 34

  1. Stefan Bürk commented on patch set 1 07/23/26, 12:27

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

  3. Stefan Bürk voted on patch set 1 CR +2 V +2 07/23/26, 12:36

  4. Stefan Bürk merged patch set 2 07/23/26, 12:36