Core still attempts to include removed .module files in Extension.php (causes warnings in D11)

Created on 16 April 2025, 6 days ago

Problem/Motivation

After upgrading from Drupal 10.4.5 to 11.1.6, Drupal logs warnings when clearing cache or rebuilding container.

The warnings are caused by Extension.php still calling `include_once` on `.module` files in core modules, even though many of them were removed in Drupal 11 (e.g., breakpoint, path, config, etc.).

Since `.module` files are now optional, this call should be wrapped in a `file_exists()` check to avoid confusion and log pollution.

This issue is reproducible on a clean install with core modules enabled.

Steps to reproduce

Start a fresh Drupal 10.4.5 site and enable common core modules

Upgrade to Drupal 11.1.6

Visit /admin/config/development/performance and clear cache

Observe warnings like:
include_once(/path/to/web/core/modules/path/path.module): Failed to open stream: No such file or directory

Detailed here β†’ .

Proposed resolution

Wrap the include_once call in file_exists() in core/lib/Drupal/Core/Extension/Extension.php, line ~153:

$full_path = $this->root . '/' . $this->getPath() . '/' . $this->filename;
if (file_exists($full_path)) {
  include_once $full_path;
}

Remaining tasks

- Confirm that the issue exists in a clean Drupal 11.1.x install
- Apply the patch
- Confirm that warnings are no longer triggered
- Write a test (optional, may not be applicable)

User interface changes

None.

Introduced terminology

None.

API changes

None. The patch only adds a file_exists() check before include_once in Extension.php.

Data model changes

None

Release notes snippet

Fixed an issue where Drupal would log warnings when attempting to load removed .module files in core modules (e.g., path.module, config.module). A file_exists() check has been added to prevent these warnings after upgrading to Drupal 11.

πŸ› Bug report
Status

Needs review

Version

11.1 πŸ”₯

Component

base system

Created by

πŸ‡§πŸ‡¦Bosnia and Herzegovina drale01 Sarajevo

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

  • Issue created by @drale01
  • I understand the point however I have been unable to reproduce the steps as currently written in the issue summary using DDEV version v1.24.3. I am tagging this issue as needing additional steps to reproduce.

  • πŸ‡ΊπŸ‡ΈUnited States nicxvan

    Core uses merge requests so please convert the patch after you confirm the steps to reproduce.

Production build 0.71.5 2024