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.