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.

CommentFileSizeAuthor
extension-pathname-check.patch602 bytesdrale01

Comments

drale01 created an issue. See original summary.

cilefen’s picture

Version: 11.1.x-dev » 11.x-dev
Status: Needs review » Postponed (maintainer needs more info)
Issue tags: +Needs steps to reproduce, +Needs merge request

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.

nicxvan’s picture

Component: base system » extension system

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

smustgrave’s picture

Since this is a fresh change wanted to bump 1 more time but I'm also not able to reproduce or experiencing this on any client sites.

nicxvan’s picture

I've seen it, I want to see if I can reproduce.

smustgrave’s picture

Should we put back into NW

nicxvan’s picture

I think pmni is still accurate

nicxvan’s picture

Status: Postponed (maintainer needs more info) » Closed (cannot reproduce)

I'm no longer sure what to do with this, I've certainly seen this working with modules without an upgrade, just switching branches.

I think this might be an APC issue, and maybe the new container key handles it better, I am also not able to reproduce it from a fresh install upgraded from 10.5 to 11.2.

I think I'll close this and can't reproduce.

If someone else can come up with steps to reproduce we can reopen this and explore further.

Either way the solution to wrap the check in file_exists is not the answer since that is called many times, we want to clear the defunct .module file.

Thanks for the push to try reproducing this myself, I missed the fact that you had tried too, that's three tests to attempt to reproduce that can't so I think we can close this for now.

Now that this issue is closed, please review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, please credit people who helped resolve this issue.