Problem/Motivation
Found a couple of problems when reviewing #3133604: Dependency compatibility check in system doesn't check if version is defined
The bug was introduced probably in #474684: Allow themes to declare dependencies on modules
We don't check dependencies for themes is only modules. So for instances you can have a theme that has
base theme: classy
dependencies:
- node
- bootstrap
And we determine what a theme's module dependencies are in \Drupal\Core\Extension\ThemeExtensionList::doList()
if (isset($theme->requires)) {
$theme->module_dependencies = array_diff_key($theme->requires, $themes);
}
Assuming that anything that isn't a theme is a module because sub themes, inherited from base theme, are added to $theme->requires
So this means in the above example if bootstrap is in the code base it will not be considered a module but if it is not then it will be considered a missing module.
So this module could be installed if bootstrap theme was in the code base but bootstrap would not be installed when installing this theme
So if the theme was then
base theme: classy
dependencies:
- node
- bootstrap (>8.x-9.x)
The ">8.x-9.x" would be ignored when installing it if bootstrap is in the code base because it is not a module. It is filtered out of $theme->module_dependencies
but then we get to system_requirements
// Check if the module exists.
if (!isset($files[$required_module])) {$files here actually is all themes and modules so then we actually do check if the version of bootstrap meets the constraint so you would get an error like
My theme requires this module and version. Currently using Bootstrap version 3.13
So installing would be ok but you get an error on the status report page or update.php
If a module has
type: module
dependencies:
- node
- bootstrap (>8.x-9.x)
bootstrap would be considered a missing module and you couldn't install your module
But if the module was installed and then - bootstrap (>8.x-9.x) was added in a update the version of bootstrap would be checked in system_requirements()
Proposed resolution
We should make sure that no current themes are in dependencies for other themes on install.
Comments
Comment #2
tedbowComment #3
tedbowComment #10
nicxvan commentedIs this still an issue?
Can you write up a test?