Review 14.3 Merged

95120[BUGFIX] Fix exception on initial TYPO3 setup with empty database

Garvin Hicking CR +2 V +2 Easy +8 −0 updated 08/06/26, 09:52

Commit message

With #110258 a new Doctrine DBAL introspection method was introduced
that replaces the deprecated API calls.

This triggered a code path in Doctrine DBAL that requires an existing
database on its connection for inspection. On a fresh setup of
TYPO3 this can lead to problems.

This patch ensures to set a "dbname" to be used for the
`SetupDatabaseService` that is available.

`information_schema` always exists and is readable by any MySQL/MariaDB
user without special grants, and `getAllDatabaseNames()` ignores
the selected database anyway (it queries information_schema.SCHEMATA
unconditionally). So this only satisfies Doctrine's precondition
without changing what gets returned.

PostgreSQL/SQLite are untouched: Postgres connections always have some
database selected by the driver even when dbname is omitted (unverified),
so `PostgreSQLMetadataProvider` never had this guard, and SQLite skips
this whole method.

Setup via:

```
vendor/bin/typo3 setup --no-interaction --force --server-type="apache"
```

now completes successfully where it previously failed with:

```
A database is required for the method:
  MySQLMetadataProvider::__construct.
```

So why did the e2e/acceptance tests not catch this?

Two independent gaps, stacked:

1. The main Playwright acceptance suite never touches this code path
   at all. runTests.sh's runPlaywright() hardcodes TYPO3_DB_DRIVER=
   sqlite (there's even a @todo: !Add support for all available
   database engines" comment on it).

   SetupCommand/InstallerController both special-case pdo_sqlite to
   skip getDatabaseList() entirely, since SQLite has no concept of
   "select a database from a server." So the suite that runs
   `vendor/bin/typo3 setup` for every other acceptance test
   structurally can't exercise the MySQL branch.

2. The dedicated MariaDB/MySQL installer e2e tests do reach this
   code, but two things let it slip through:

  - InstallerController::showDatabaseSelectAction() wraps
    getDatabaseList() in try { … } catch (\Exception $exception) { ... }
    the exception is swallowed into a soft error list, and the endpoint
    still returns success with a rendered (if empty/erroring) page. The
    CLI path has no such fallback SetupCommand::selectAndImportDatabase()
    catches DBALException and hard-fails).

  - install-mariadb.spec.ts / install-mysql.spec.ts only assert the
    heading "Select a database" is visible, then immediately click
    #t3-install-form-db-select-type-new and type a brand-new database
    name: the "create new database" shortcut. They never assert the
    existing-database list actually populated or that no error banner
    appeared, so the swallowed exception is invisible to the test.
    The CLI flow the user hits (dbname=db, pre-created by ddev) has no
    "new database" escape hatch — it must resolve an existing database
    via the now-broken list.

So the bug requires exactly what `ddev tryout delete` does — CLI setup,
MySQL-family driver, against a database that already exists —
and none of the current test coverage reproduces that specific
combination.

This needs coverage in a follow-up patch with proper adjustments.

Review

  • Code review CR +2 Done
    • Garvin Hicking +2
  • Verified V +2 Done
    • Garvin Hicking +2
    • core-ci +1 CI

Issues 2

Files 1

Review log 34

  1. Garvin Hicking commented on patch set 1 08/06/26, 09:29

    Cherry Picked from branch main.
  2. core-ci voted on patch set 1 V +1 08/06/26, 09:39 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/105995

  3. Garvin Hicking voted on patch set 1 CR +2 V +2 08/06/26, 09:51

  4. Garvin Hicking merged patch set 2 08/06/26, 09:52