Review main Merged

93181[BUGFIX] Respect DBAL `serverVersion` in `getPlatformServerVersion()`

Rico Sonntag CR +2 V +2 Normal +49 −3 updated 04/11/26, 18:22

Commit message

Doctrine DBAL does a really good job to determine the database
vendor and version from the database system itself. Still, this
can fail in some setups, for example in case a SQL proxy is used
which may report a custom version and lead to wrong database
platform detection within Doctrine DBAL consumers.

With `doctrine/dbal:^4` the `ServerVersionProvider` interface
has been introduced, which every connection for all supported
databases implement.

Additionally a `StaticServerVersionProvider` has been added,
which can be used to resolve the server version based on config
values like `serverVersion` on the database connection, or for
the primary connection of a master/slave setup.

That is handled in DBAL's `getDatabasePlatform()` method to set
the suitable platform class based on this server
information.

Since TYPO3 v13, the method `Connection->getPlatformServerVersion()`
is utilized as a wrapper for this DBAL method, whenever version
information is utilized. It returned the `real` reported version
of the SQL connection, ignoring any configured values.

This change streamlines `getPlatformServerVersion()` by making
use of the `ServerVersionProvider` logic just like it is performed
by Doctrine DBAL itself in `getDatabasePlatform()`.

A wrapper method `typo3_getServerVersionProvider()` is utiliezd for
this, with the goal to contribute that to upstream `doctrine/dbal`
and be able to remove it in the future from TYPO3 Core.

This patch now prevents displaying different version information for
the SQL connection, which could lead to confusion for system
maintainers.

A future follow-up patch may deal with displaying both the
"native" and "configured" sever version information.

Review

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

Issues 1

Files 2

Review log 2128

Show 23 earlier messages
  1. Rico Sonntag uploaded patch set 1 03/13/26, 15:28

  2. core-ci voted on patch set 1 V -1 03/13/26, 15:36 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/97912

  3. Rico Sonntag commented on patch set 1 03/13/26, 18:34

    The PHPStan failure is unrelated to this change. All 8 errors are pre-existing custom.namedArguments violations in TemplatedEmailFactory::createWithOverrides() calls across core/Mail, felogin, form, install, linkvalidator, reports and workspaces. None of the affected files are touched by this patch (which only modifies Connection.php).
  1. Stefan Bürk commented on patch set 1 CR -2 03/13/26, 21:12

    tmp -2 ..need to look on this after the weekend
  2. Rico Sonntag rebased onto patch set 2 V -1 03/13/26, 21:22

    Copied Votes: * Code-Review-2 (copy condition: "changekind:NO_CHANGE OR **is:MIN**")
  3. core-ci voted on patch set 2 V +1 03/13/26, 21:59 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/97921

  4. Rico Sonntag commented on patch set 2 03/23/26, 10:16

    Hi Stefan, just a friendly ping on this one. You mentioned you'd take a closer look after the weekend — any chance you've had time to review it? Happy to address any concerns. Thanks!
  5. Stefan Bürk uploaded patch set 3 V +1 04/11/26, 11:36

    Copied Votes: * Code-Review-2 (copy condition: "changekind:NO_CHANGE OR **is:MIN**")
  6. Stefan Bürk commented on patch set 2 CR -2 04/11/26, 11:37

    Connection.php:361

    This solution does not take primary/slave connection configuration in general. I push a additional test to make this visible first, and than the solution I would prefere here. * Patchset #3 -> adding the test * Patchset #4 -> the modified fix making the test green again. **Background** The general logic is to use a`ServerVersionProvider`, which all connections are by default, and commonly gathering the version from the server. `getDatabasePlatform()` checks the params and creates in case of manual set `serverVersion` directly for the connection or for the primary server a `StaticServerVersionProvider` implementation. Doctrine does not provide that switch directly for now (trying to provide that upstream) and I would add a protect method return the suitable ServerVersionProvider doing the same switch and using that to get the version. Meanwhile this would put the maintenance burden on our-side, but having a good feeling to get that upstream in we would be able to remove the own method after having that provided by doctrine and remove the maintenance burden then. It may seem a little bit over-complicated, but instead of dealing with direct workflow here I would really align with doctrine here as far as possible.
  7. Stefan Bürk commented on patch set 3 CR -2 04/11/26, 11:44

    Connection.php:361 Reply

    TYPO3 v12 needs a completly other approach related to have the old server version handling in place with Doctrine DBAL 3. I guess that we need to do that there directly, not sure about the impact. Risk assement needs to be done with 12LTS backport - doing that when having looked into how to do that for TYPO3 v12.
  8. core-ci voted on patch set 3 V -1 04/11/26, 12:11 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/99963

  9. Stefan Bürk uploaded patch set 4 V -1 04/11/26, 12:24

    Copied Votes: * Code-Review-2 (copy condition: "changekind:NO_CHANGE OR **is:MIN**")
  10. core-ci voted on patch set 4 V -1 04/11/26, 12:35 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/99966

  11. core-ci voted on patch set 4 V +1 04/11/26, 12:40 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/99966

  12. Stefan Bürk commented on patch set 4 CR +1 V +1 04/11/26, 13:25

    Reply

    Done
    Note that I dropped the TYPO v12 backport. In TYPO3 v12 the implementation is kind of circle implemented, one of the reason why I splitted that in TYPO3 v14 beside having to make the `getServerVersion()` free from customization. In v12 `getServerVersion()` is not only used in kind of a cycle and not only for display purpose like `getPlatformServerVersion()` for v13 and main, but also for some real functional decision in couple of places throughout the core. A backport would require a complemte new implementation and replacing it in different places, some kind of public and possible overriden/changed by users (extensions). Therefore the risk to break functionality is higher than have the "display purpose" fixed and the reason for dropping the v12 backport, even more having the upcoming shift into ELTS in mind.

    Connection.php:361 Reply

    Done
  13. Oliver Klee voted on patch set 4 V +1 04/11/26, 13:32

  14. Stefan Bürk voted on patch set 4 CR 0 V 0 04/11/26, 14:01

  15. Garvin Hicking updated the commit message in patch set 5 V +1 04/11/26, 17:52

  16. Garvin Hicking voted on patch set 5 CR +1 V +1 04/11/26, 17:52

  17. Oliver Klee voted on patch set 5 V +1 04/11/26, 17:53

  18. Stefan Bürk updated the commit message in patch set 6 CR +1 V +1 04/11/26, 17:57

  19. Garvin Hicking voted on patch set 6 CR +1 V +1 04/11/26, 17:59

  20. Oliver Klee voted on patch set 6 V +1 04/11/26, 18:01

  21. Oliver Klee voted on patch set 6 CR +1 04/11/26, 18:01

  22. core-ci voted on patch set 5 V +1 04/11/26, 18:04 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/99977

  23. core-ci voted on patch set 6 V +1 04/11/26, 18:09 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/99979

  24. Stefan Bürk voted on patch set 6 CR +2 V +2 04/11/26, 18:09

  25. Stefan Bürk merged patch set 7 04/11/26, 18:22