From a80dddcc3a0f0d4bfa2d89109605f132fb7d9d46 Mon Sep 17 00:00:00 2001
From: Alex Pott <alex.a.pott@googlemail.com>
Date: Wed, 29 Jun 2022 11:36:35 +0100
Subject: [PATCH] Issue #3291830 by webflo: Fix PSR4 path for database driver

---
 core/lib/Drupal/Core/Site/Settings.php             | 2 +-
 core/tests/Drupal/Tests/Core/Site/SettingsTest.php | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/core/lib/Drupal/Core/Site/Settings.php b/core/lib/Drupal/Core/Site/Settings.php
index 64965ceb3cda..245bc3537e67 100644
--- a/core/lib/Drupal/Core/Site/Settings.php
+++ b/core/lib/Drupal/Core/Site/Settings.php
@@ -190,7 +190,7 @@ public static function initialize($app_root, $site_path, &$class_loader) {
         // the database. Therefore, allow the connection info to specify an
         // autoload directory for the driver.
         if (isset($info['autoload'])) {
-          $class_loader->addPsr4($info['namespace'] . '\\', $info['autoload']);
+          $class_loader->addPsr4($info['namespace'] . '\\', $app_root . '/' . $info['autoload']);
         }
       }
     }
diff --git a/core/tests/Drupal/Tests/Core/Site/SettingsTest.php b/core/tests/Drupal/Tests/Core/Site/SettingsTest.php
index b5ab4f4f1e41..5d860aa13925 100644
--- a/core/tests/Drupal/Tests/Core/Site/SettingsTest.php
+++ b/core/tests/Drupal/Tests/Core/Site/SettingsTest.php
@@ -336,7 +336,7 @@ public function testDatabaseInfoInitialization(string $driver, ?string $namespac
     if (!empty($expected_autoload)) {
       $class_loader->expects($this->once())
         ->method('addPsr4')
-        ->with($expected_namespace . '\\', $expected_autoload);
+        ->with($expected_namespace . '\\', vfsStream::url('root') . '/' . $expected_autoload);
     }
     else {
       $class_loader->expects($this->never())
-- 
GitLab