[regression] Drupal 9.4 breaks BC of \Drupal\Driver\* overriding core drivers during installation and parsing connection URLs

Created on 14 June 2022, over 2 years ago
Updated 12 April 2023, over 1 year ago

Problem/Motivation

#3284502: [regression] Drupal 9.4 breaks BC via incorrect autoloading of \Drupal\Driver\* overrides of core db drivers β†’ fixed this same regression when $databases is read from settings.php. However, there are two other places where Drupal needs to decide which namespace to use for a given driver:

  • drupal_get_database_types(), which is called during the installation step of selecting your database type and entering your database credentials, when you don't already have a settings.php file with $databases defined.
  • Database::convertDbUrlToConnectionInfo(), which is called when you're using a database connection URL instead of the $databases variable in settings.php. For example, for running tests or console commands where a database URL is provided as an environment variable or command line argument.

Just like in that other issue, in both of the above places, Drupal 9.3 prioritized the \Drupal\Driver\* implementation (if the site has one) ahead of the core implementation. However, as part of Drupal 9.4 moving the core implementations into core modules, they are now getting prioritized ahead of the \Drupal\Driver\* implementation.

Steps to reproduce

  • Get a checkout of 9.4.x
  • If you have a pre-existing sites/default/settings.php file, remove it
  • composer require drupal/mysql56:@dev
  • Try running the web installer on MySQL 5.6. Or, if you don't have MySQL 5.6, edit the MYSQL_MINIMUM_VERSION constant in core/modules/mysql/src/Driver/Database/mysql/Install/Tasks.php to a higher version than what you have.

Desired behavior: Installation proceeds normally, because the driver in vendor/drupal/mysql56 is used.

Actual behavior: Installation fails with a your database version is too low message, because the driver in core/modules/mysql is used.

Workaround: Manually add a sites/default/settings.php where you add all your database connection info to the $databases variable, including setting 'namespace' => 'Drupal\\Driver\\Database\\mysql', and rerun the installer.

Proposed resolution

Restore BC with Drupal 9.3 by only for the 3 core drivers, checking for a \Drupal\Driver\* override and use that if available.

Remaining tasks

User interface changes

API changes

Data model changes

Release notes snippet

πŸ› Bug report
Status

Needs work

Version

9.5

Component
DatabaseΒ  β†’

Last updated about 11 hours ago

  • Maintained by
  • πŸ‡³πŸ‡±Netherlands @daffie
Created by

πŸ‡ΊπŸ‡ΈUnited States effulgentsia

Live updates comments and jobs are added and updated live.
  • Needs tests

    The change is currently missing an automated test that fails when run with the original code, and succeeds when the bug has been fixed.

Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • πŸ‡¬πŸ‡§United Kingdom catch

    It's not clear that this is affecting anyone apart from one particularly large hosting provider, and I imagine they've worked around it by now otherwise a lot of sites would still be on 9.3, so downgrading.

Production build 0.71.5 2024