Problem/Motivation

This might not be a bug with Drupal, but rather one with Composer. Or perhaps not a bug at all.

Steps to reproduce

While debugging something else, I noticed that in vendor/composer/ClassLoader.php::loadClass(), when loading this class:

Drupal\mysql\Driver\Database\mysql\Connection

The returned path file path is this:

/var/www/html/web/core/modules/mysql/src/Driver/Database/mysql//Connection.php

Notice that there are two slashes in a row. "mysql//Connection.php"

These can be found by creating a conditional breakpoint in ClassLoader inside

function includeFile($file)
{
    include $file;
}

The breakpoint condition can be str_contains($file, '//')

I am using Drupal 9.4.8 with PHP 8.1.11 and composer 2.4.3.

Comments

solideogloria created an issue. See original summary.

cilefen’s picture

Isn't that one of the problematic classes that had to be worked around in some use-cases? In this case I mean #3290924: [regression] With Drupal 9.4, can no longer call Database::getConnection() from within settings.php due to driver classes not yet in autoloader. And the workaround was to define these namespaces in settings.php. Is that possibly the case with the affected site?

solideogloria’s picture

I am not calling Database::getConnection from settings.php. In fact, I have no errors at all. I just happened to see this odd result while debugging something else.

cilefen’s picture

Is only this class affected?

solideogloria’s picture

No, it appears any class within that parent folder shows that way, such as

/var/www/html/web/core/modules/mysql/src/Driver/Database/mysql//Select.php
/var/www/html/web/core/modules/mysql/src/Driver/Database/mysql//Update.php
/var/www/html/web/core/modules/mysql/src/Driver/Database/mysql//Delete.php
/var/www/html/web/core/modules/mysql/src/Driver/Database/mysql//Merge.php

I don't know if it happens for other DB drivers.

solideogloria’s picture

These can be found by creating a conditional breakpoint in ClassLoader inside

function includeFile($file)
{
    include $file;
}

The breakpoint condition can be str_contains($file, '//')

solideogloria’s picture

Issue summary: View changes

Version: 9.4.x-dev » 9.5.x-dev

Drupal 9.4.9 was released on December 7, 2022 and is the final full bugfix release for the Drupal 9.4.x series. Drupal 9.4.x will not receive any further development aside from security fixes. Drupal 9 bug reports should be targeted for the 9.5.x-dev branch from now on, and new development or disruptive changes should be targeted for the 10.1.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 9.5.x-dev » 11.x-dev

Drupal core is moving towards using a “main” branch. As an interim step, a new 11.x branch has been opened, as Drupal.org infrastructure cannot currently fully support a branch named main. New developments and disruptive changes should now be targeted for the 11.x branch. For more information, see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 11.x-dev » main

Drupal core is now using the main branch as the primary development branch. New developments and disruptive changes should now be targeted to the main branch.

Read more in the announcement.