You are here

What is overriding your Drupal config?

Something is overriding config in Drupal - you can see it by invoking drush with and without the flag to include overrides:

$ drush cget system.performance | grep -B1 preprocess
css:
  preprocess: false
--
js:
  preprocess: false
$ drush cget --include-overridden system.performance | grep -B1 preprocess
css:
  preprocess: true
--
js:
  preprocess: true

Perhaps we want to turn this config off, but these overrides won't let us.

Where are these config overrides coming from?

Generally, overrides can come from two places - for example, see:

https://git.drupalcode.org/project/drupal/-/blob/10.2.3/core/lib/Drupal/Core/Config/Config.php#L280

      // Apply overrides.
      if (isset($this->moduleOverrides) && is_array($this->moduleOverrides)) {
        $original_data = NestedArray::mergeDeepArray([$original_data, $this->moduleOverrides], TRUE);
      }
      if (isset($this->settingsOverrides) && is_array($this->settingsOverrides)) {
        $original_data = NestedArray::mergeDeepArray([$original_data, $this->settingsOverrides], TRUE);
      }

There could be an override in settings(.php) or perhaps it's coming from a module. How can we tell which?

The settingsOverrides and moduleOverrides properties of the config object are protected, but in modern PHP there's at least one trick we can use to have quick look at them.

$ drush ev "var_dump((fn() => \$this->moduleOverrides)->call(\Drupal::config('system.performance')))"
NULL

$ drush ev "var_dump((fn() => \$this->settingsOverrides)->call(\Drupal::config('system.performance')))"
array(2) {
  ["css"]=>
  array(1) {
    ["preprocess"]=>
    bool(true)
  }
  ["js"]=>
  array(1) {
    ["preprocess"]=>
    bool(true)
  }
}

So we can tell that these overrides are coming from settings as opposed to modules.

Hopefully that'll help us track them down.