Issue Bug Closed

#106989Doctrine DBAL DSN/URL support for database connections is missing

Thomas Maroschik 06/26/25, 18:16 updated 12/02/25, 14:37

Description

In TYPO3 12, it was possible to configure the database connection using a DSN URL in LocalConfiguration.php, like so:

'DB' => [
    'Connections' => [
        'Default' => [
            'url' => 'mysqli://user:password@host:3306/database',
        ],
    ],
],

This functionality appears to be broken in TYPO3 13. When using a DSN URL, the connection parameters are not parsed, leading to a connection failure. This is a regression from TYPO3 12.

The issue stems from the deprecation and subsequent removal of automatic DSN URL parsing within Doctrine DBAL itself. As of Doctrine DBAL 3, the url connection parameter is deprecated, and direct support was removed in a later version. The recommended approach is to use the Doctrine\DBAL\Tools\DsnParser to parse the URL before establishing the connection.

TYPO3 Core’s ConnectionPool::getConnectionByName() method currently does not perform this parsing step, which causes the connection parameters to remain empty if only a URL is provided.

Proposed Solution:

A simple fix can be implemented in TYPO3\CMS\Core\Database\ConnectionPool::getConnectionParams(). By adding a check for the url parameter and using the DsnParser, backwards compatibility can be restored.

This issue was briefly discussed with TYPO3 Core Merger Stefan Bürk, who pointed out the deprecation in Doctrine DBAL. The deprecation notice from Doctrine is as follows:

Deprecation::trigger(
    'doctrine/dbal',
    'https://github.com/doctrine/dbal/pull/5843',
    'The "url" connection parameter is deprecated. Please use %s to parse a database url before calling %s.',
    DsnParser::class,
    self::class,
);

Reviews 5