[Drupal 9.4.1] - pgsql namespace not working

Created on 8 July 2022, over 2 years ago
Updated 7 July 2023, over 1 year ago

Problem/Motivation

In order to use database versioning via liquibase, we are using custom autoload and namespace that we have defined in the settings.php

Example :

$databases['default']['default'] = array (
  ...
  'namespace' => 'Drupal\CUSTOM_MODULE_NAME\Driver\Database\pgsql',
  'autoload' => "modules/custom/CUSTOM_MODULE_NAME/src/Driver/Database/pgsql/",
  'driver' => 'pgsql',
  ...
);

The site was working fine in 9.3.16 but after updating to 9.4.1 we have a namespace error.

It says :

Error: Class 'Drupal\pgsql\Driver\Database\pgsql\Connection' not found in include() (line 17 of \web\modules\custom\CUSTOM_MODULE_NAME\src\Driver\Database\pgsql\Connection.php).
include() (Line: 571)
Composer\Autoload\includeFile('modules/custom/CUSTOM_MODULE_NAME/src/Driver/Database/pgsql/\Connection.php') (Line: 428)
Composer\Autoload\ClassLoader->loadClass('Drupal\CUSTOM_MODULE_NAME\Driver\Database\pgsql\Connection')
spl_autoload_call('Drupal\CUSTOM_MODULE_NAME\Driver\Database\pgsql\Connection') (Line: 432)
Drupal\Core\Database\Database::openConnection('default', 'default') (Line: 189)
Drupal\Core\Database\Database::getConnection('default')
call_user_func_array('Drupal\Core\Database\Database::getConnection', Array) (Line: 79)
Drupal\Component\DependencyInjection\PhpArrayContainer->createService(Array, 'database') (Line: 176)
Drupal\Component\DependencyInjection\Container->get('database', 1) (Line: 212)
Drupal\Component\DependencyInjection\PhpArrayContainer->resolveServicesAndParameters(Array) (Line: 62)
Drupal\Component\DependencyInjection\PhpArrayContainer->createService(Array, 'cache.container') (Line: 176)
Drupal\Component\DependencyInjection\Container->get('cache.container') (Line: 550)
Drupal\Core\DrupalKernel->getCachedContainerDefinition() (Line: 895)
Drupal\Core\DrupalKernel->initializeContainer() (Line: 472)
Drupal\Core\DrupalKernel->boot() (Line: 708)
Drupal\Core\DrupalKernel->handle(Object) (Line: 19)

We have tried every patch relating to database driver's location change but nothing works (https://www.drupal.org/project/drupal/issues/3129043).

The only thing that work for us is if we put an include_once in CUSTOM_MODULE_NAME/src/Driver/Database/pgsql/Connection.php, just above the use statement

e.g

namespace Drupal\CUSTOM_MODULE_NAME\Driver\Database\pgsql;

include_once dirname(__DIR__, 8) . '/web/core/modules/pgsql/src/Driver/Database/pgsql/Connection.php';

use Drupal\pgsql\Driver\Database\pgsql\Connection as BaseConnection;

Does anyone have any idea or solution?

Thanks in advance

πŸ› Bug report
Status

Closed: duplicate

Version

9.5

Component
PostgreSQL driverΒ  β†’

Last updated 22 days ago

No maintainer
Created by

πŸ‡«πŸ‡·France rehansyed89

Live updates comments and jobs are added and updated live.
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 States Kristen Pol Santa Cruz, CA, USA

    Thanks for reporting this issue. We rely on issue reports like this one to resolve bugs and improve Drupal core.

    As part of the Bug Smash Initiative, we are triaging issues that are marked "Postponed (maintainer needs more info)". This issue was marked "Postponed (maintainer needs more info)" more than 6 months ago with a request for more information and there has been no activity since that time.

    Since we need more information to move forward with this issue, I am tagging for Bug Smash Initiative and keeping the status at Postponed (maintainer needs more info). If we don't receive additional information to help with the issue, it may be closed after three months.

    Thanks!

  • Status changed to Closed: duplicate over 1 year ago
  • πŸ‡³πŸ‡ΏNew Zealand quietone

    More information was asked for 1 year ago and again 4 months ago and none has been supplied.

    I also think @cilefen is on the right track. I think this is a duplicate of πŸ› [regression] Drupal 9.4 breaks BC of \Drupal\Driver\* overriding core drivers during installation and parsing connection URLs Needs work . That issue has a more discussion and workaround in the Issue Summary.

    I am closing this as a duplicate.

Production build 0.71.5 2024