Review main Merged

93665[BUGFIX] Mitigate DI issues during database compare

Stefan Bürk CR +2 V +2 Normal +21 −38 updated 04/16/26, 16:34

Commit message

Patch #106867 changed the database restrictions to avoid
direct $GLOBALS['TCA]' access by switching to TcaSchema.
The patch already had to work around ext:install related
DI woes.

This patch adapts another detail: The query fired by
ConnectionMigrator that looks for table options (collation,
charset, ...) is run early without DI fully set up. The
patch #109437 worked on that already by re-using a
RestrictionContainer based workaround. This is not
sufficient with custom query restrictions.

The patch reverts the solution from #109437, and rewrites
the specific table options query to use the low level
doctrine QueryBuilder directly, circumventing all normal
TYPO3 logic on top. This is a pragmatic and stable approach
to the problem in this case since TYPO3 higher level logic
never deals with schema details.

Note issue #100807 has been reported a while ago for older
core majors already, it is only just now that the issue
becomes more promintent due to the v14 works. Nevertheless,
we'll aim for a v13 backport, since it is the same solution
in just a slightly different context, and mitigates the
issue quite effectively.

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 4

Files 3

Review log 2132

Show 47 earlier messages
  1. Stefan Bürk uploaded patch set 1 04/14/26, 12:51

  2. Stefan Bürk uploaded patch set 2 04/14/26, 13:04

  3. core-ci voted on patch set 1 V +1 04/14/26, 13:04 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/100156

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

  5. Stefan Bürk wrote 04/14/26, 17:37

    Topic set to database-analyzer
  6. Stefan Bürk updated the commit message in patch set 3 V +1 04/15/26, 07:52

  7. core-ci voted on patch set 3 V +1 04/15/26, 08:01 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/100234

  1. Anja Leichsenring voted on patch set 3 CR +1 V +1 04/15/26, 10:17

  2. Benjamin Franzke commented on patch set 3 04/15/26, 10:55

    QueryBuilder.php:143

    General question: Could we build a custom query builder in https://review.typo3.org/c/Packages/TYPO3.CMS/+/93613/4/typo3/sysext/core/Classes/Database/Schema/ConnectionMigrator.php#1417 instead of only resetting restrictions? Something like: ``` $queryBuilder = new QueryBuilder( connection: $this->connection, restrictionContainer: new EmptyRestrictionContainer(), // Ensure `$GLOBALS['TYPO3_CONF_VARS']['DB']['additionalQueryRestrictions']` is not taken into account additionalRestrictions: [] ); ``` (Of course this requires a change in QueryBuilder as well) ``` -$this->additionalRestrictions = $additionalRestrictions ?: $GLOBALS['TYPO3_CONF_VARS']['DB']['additionalQueryRestrictions'] ?? []; +$this->additionalRestrictions = $additionalRestrictions ?? $GLOBALS['TYPO3_CONF_VARS']['DB']['additionalQueryRestrictions'] ?? []; ``` This would avoid having to create a new dummy (NullRestrictionContainer) in here, to guess behavior/execution environment. Disclaimer: I didn't test this, it is really just a question, which could help to simplify the code/situation. Not a blocker, if you feel this complicates things.
  3. Stefan Bürk commented on patch set 3 CR -1 04/15/26, 10:58

    QueryBuilder.php:143 Reply

    Going to check that later, thanks for the input.
  4. Stefan Bürk uploaded patch set 4 CR +1 V +1 04/15/26, 14:21

  5. Stefan Bürk uploaded patch set 5 04/15/26, 14:23

  6. Stefan Bürk commented on patch set 5 04/15/26, 14:38

    QueryBuilder.php:143 Reply

    @ben@bnf.dev I decided to use the Doctrine DBAL QueryBuilder directly instead of our decorated QueryBuilder for that single query in `ConnectionMigrator`. I also removed the workaround in `SchemaMigrator` introduced recently for #109437. The fix in QueryBuilder to reset the restriction container to the configured defaultRestrictionContainer is kept - but we can extract that and do it in a dedicated change. Let me know if the change now would be fine for you until we have DI in database related classes working (your change pending around).
  7. core-ci voted on patch set 5 V -1 04/15/26, 14:39 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/100255

  8. core-ci voted on patch set 4 V -1 04/15/26, 14:55 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/100254

  9. Stefan Bürk uploaded patch set 6 V -1 04/15/26, 15:09

  10. core-ci voted on patch set 6 V -1 04/15/26, 16:11 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/100259

  11. core-ci commented on patch set 6 04/15/26, 17:06 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/100259

  12. core-ci commented on patch set 6 04/15/26, 17:09 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/100259

  13. Benjamin Franzke commented on patch set 6 04/15/26, 21:05

    QueryBuilder.php:143 Reply

    Looks good, thanks a bunch! Also the defaultRestrictionContainer change is fine for me as a drive-by, as well.
  14. Stefan Bürk uploaded patch set 7 V -1 04/15/26, 22:32

  15. core-ci voted on patch set 7 V +1 04/15/26, 22:41 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/100274

  16. Stefan Bürk updated the commit message in patch set 8 V +1 04/16/26, 12:40

  17. core-ci voted on patch set 8 V +1 04/16/26, 12:50 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/100316

  18. Christian Kuhn uploaded patch set 9 V +1 04/16/26, 14:03

  19. Christian Kuhn commented on patch set 8 04/16/26, 14:04

    This change is ready for review.

    QueryBuilder.php:157

    fyi: this is drive-by for consistency.
  20. Christian Kuhn marked it ready for review 04/16/26, 14:04

  21. Christian Kuhn voted on patch set 9 CR +1 V +1 04/16/26, 14:06

  22. core-ci voted on patch set 9 V +1 04/16/26, 14:41 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/100330

  23. Anja Leichsenring voted on patch set 9 CR +1 V +1 04/16/26, 15:56

  24. Stefan Bürk voted on patch set 9 CR +2 V +2 04/16/26, 15:58

  25. Stefan Bürk merged patch set 10 04/16/26, 16:34