diff --git a/core/lib/Drupal/Core/Database/Database.php b/core/lib/Drupal/Core/Database/Database.php old mode 100644 new mode 100755 index d13ea80..8d638f2 --- a/core/lib/Drupal/Core/Database/Database.php +++ b/core/lib/Drupal/Core/Database/Database.php @@ -365,7 +365,7 @@ throw new DriverNotSpecifiedException('Driver not specified for this database connection: ' . $key); } - $namespace = static::getDatabaseDriverNamespace(self::$databaseInfo[$key][$target]); + $namespace = $info['namespace']; $driver_class = $namespace . '\\Connection'; $pdo_connection = $driver_class::open(self::$databaseInfo[$key][$target]); @@ -488,7 +488,8 @@ public static function getConnectionInfoAsUrl($key = 'default') { if (empty($db_info) || empty($db_info['default'])) { throw new \RuntimeException("Database connection $key not defined or missing the 'default' settings"); } - $connection_class = static::getDatabaseDriverNamespace($db_info['default']) . '\\Connection'; + + $connection_class = $info['namespace']; return $connection_class::createUrlFromConnectionOptions($db_info['default']); } @@ -502,8 +503,13 @@ public static function getConnectionInfoAsUrl($key = 'default') { * * @return string * The PHP namespace of the driver's database. + * + * @deprecated in drupal:9.0.0 and is removed from drupal:10.0.0. + * $info['namespace] is always set now. + * @see https://www.drupal.org/project/drupal/issues/3112476 */ protected static function getDatabaseDriverNamespace(array $connection_info) { + @trigger_error("getDatabaseDriverNamespace() is deprecated in drupal:9.1.0 and is removed from drupal:10.0.0. $info['namespace'] is always set now. See https://www.drupal.org/project/drupal/issues/3115388.", E_USER_DEPRECATED); if (isset($connection_info['namespace'])) { return $connection_info['namespace']; }