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.
| Comment | File | Size | Author |
|---|---|---|---|
| extension-pathname-check.patch | 602 bytes | drale01 |
Comments
Comment #2
cilefen commentedI 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.
Comment #3
nicxvan commentedCore uses merge requests so please convert the patch after you confirm the steps to reproduce.
Comment #4
smustgrave commentedSince 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.
Comment #5
nicxvan commentedI've seen it, I want to see if I can reproduce.
Comment #6
smustgrave commentedShould we put back into NW
Comment #7
nicxvan commentedI think pmni is still accurate
Comment #8
nicxvan commentedI'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.