Review main Merged

93613[BUGFIX] Enforce `EmptyRestrictionContainer` during database comparison

Stefan Bürk CR +2 V +2 Easy +22 −2 updated 04/12/26, 11:06

Commit message

Change #106867 introduced the use of `TcaSchemaFactory` for
handling database restrictions, including its associated
container. It also added a fallback to `EmptyRestrictionContainer`
in the `ConnectionPool` factory within the low-level ServiceProvider
of `EXT:core`.

The default connection is typically initialized early, which
results in `EmptyRestrictionContainer` being statically cached
within the `ConnectionPool`. Additional database connections,
however, are created later—after the late boot process has
completed—and end up using `DefaultRestrictionContainer`, which
depends on proper dependency injection for `TcaSchemaFactory`.

Notably, the exception only occurred when a `TableMapping` was
configured for a table without a virtual definition in either
`ext_tables.sql` or the TCA-based `DefaultTcaSchema`.
This made the issue somewhat difficult to reproduce initially.

Dependency injection for database-related services is currently
not supported in a consistent or streamlined way.

While improvements are being discussed (see [1]), they are not
feasible at the moment.

To address this issue, `EmptyRestrictionContainer` is now
enforced for all connections used during database analyzer
comparison in `SchemaMigrator`. A backup and restore mechanism
ensures that this override is limited to a well-defined scope.

Due to the complexity of the setup, there is currently no
straightforward way to reproduce this scenario in a phpunit
functional test, which is why no test has been added.

[1] https://review.typo3.org/c/Packages/TYPO3.CMS/+/89956

Review

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

Issues 2

Files 2

Review log 912

  1. Stefan Bürk uploaded patch set 1 04/10/26, 09:20

  2. core-ci voted on patch set 1 V -1 04/10/26, 09:30 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/99908

  3. Stefan Bürk uploaded patch set 2 V -1 04/10/26, 10:07

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

  5. Anja Leichsenring commented on patch set 2 V +1 04/11/26, 04:57

    code works, no exception in sight, but this commit message needs some tender love and care. It is currently hard to comprehend, let's look at it together to clear things up.
  6. Stefan Bürk updated the commit message in patch set 3 V +1 04/11/26, 19:48

  7. core-ci voted on patch set 3 V +1 04/11/26, 19:58 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/99990

  8. Stefan Bürk wrote 04/11/26, 23:10

    Topic set to doctrine/dbal
  9. Anja Leichsenring commented on patch set 3 CR +1 V +1 04/12/26, 04:13

    thank you for the clarification.
  10. Christian Kuhn voted on patch set 3 CR +1 V +1 04/12/26, 10:55

  11. Stefan Bürk voted on patch set 3 CR +2 V +2 04/12/26, 11:06

  12. Stefan Bürk merged patch set 4 04/12/26, 11:06