#110255Fix broken TableDiff::getDroppedForeignKeyConstraintNames()
Description
`TYPO3\CMS\Core\Database\Schema\TableDiff` extends the Doctrine DBAL `TableDiff`
and deliberately does not call the parent constructor, because it re-declares all
constructor properties as public to restore direct property access. Doctrine
declares them as `private readonly`, so parent and child hold two distinct
properties of the same name.
Every inherited getter TYPO3 relies on is overridden accordingly – except
`getDroppedForeignKeyConstraintNames()`, which Doctrine added in 4.4 as the
replacement for the now deprecated `getDroppedForeignKeys()`. That method reads
the Doctrine property directly, which is never initialised for a TYPO3
`TableDiff`, so any call fails:
Error: Typed property Doctrine\DBAL\Schema\TableDiff::$droppedForeignKeys
must not be accessed before initialization
Reproduce:
$diff = new \TYPO3\CMS\Core\Database\Schema\TableDiff(new \Doctrine\DBAL\Schema\Table(‘a_table’));
$diff->getDroppedForeignKeyConstraintNames();
Nothing in TYPO3 or in Doctrine DBAL 4.4 calls the method yet, so the defect is
latent today. It becomes reachable as soon as the schema managers switch to the
new API, which happens with Doctrine DBAL 5.0.
The two other inherited methods reading Doctrine properties,
`getModifiedColumns()` and `getRenamedColumns()`, are not affected: both go
through the overridden `getChangedColumns()`.
Resolution: override the method, reading the re-declared property, keeping the
parent behaviour including the `InvalidState` exception for unnamed constraints.
Additionally the `@deprecated` annotations of the overridden parent methods
`getModifiedIndexes()`, `getModifiedForeignKeys()` and `getDroppedForeignKeys()`
are adopted from the parent, as overriding a method drops the inherited docblock
and with it the deprecation notice for IDEs and static analysis.
Purely additive, no behaviour change for existing callers.
Reviews 3
History 25
-
Gerrit Code Review pushed patch set 1 for main to change 94870 status
NewUnder Review <span data-processor="relativetime" data-value="2026-07-21T20:18:48+00:00" > 07/21/26, 20:18 </span> -
Gerrit Code Review pushed patch set 1 for 14.3 to change 94892 <span data-processor="relativetime" data-value="2026-07-23T07:51:14+00:00" > 07/23/26, 07:51 </span>
-
Gerrit Code Review pushed patch set 1 for 13.4 to change 94893 <span data-processor="relativetime" data-value="2026-07-23T07:51:30+00:00" > 07/23/26, 07:51 </span>
-
Stefan Bürk commented and changed status
Under ReviewResolved done0 %100 % <span data-processor="relativetime" data-value="2026-07-23T08:10:09+00:00" > 07/23/26, 08:10 </span> -
Benni Mack changed status
ResolvedClosed <span data-processor="relativetime" data-value="2026-08-11T08:51:53+00:00" > 08/11/26, 08:51 </span>
Applied in changeset commit:f504fa76cecf8d67a9d1aa97130f3b3db6790c4a.