Ignoring values in config is not working

Created on 10 September 2024, about 1 year ago

Problem/Motivation

Not sure if it's something I'm missing in the documentation or if it's actually a bug..

But I have exported a configuration with an empty ignored_config_entities setting. After that I wanted to ignore a value in a config file with the ':' pattern syntax.
Doing a new config export, the value is still in the exported config.

Steps to reproduce

Do an export without ignoring patterns, so you get a clean export.
Edit the ignore config settings and add a pattern to ignore a specific value (example ignore all '_core' settings using the pattern '*:_core').
Do the export again.
The '_core' keys are still present in the configs.

Proposed resolution

There is a specific piece of code that deals with ignoring the keys. The one for the 'create' operation correctly unsets the key from the $transformation array. However since we already have done an export, we are falling into the 'update' operation. There the value is just reassigned.

ConfigIgnoreEventSubscriber:318:

if ($match === TRUE) {
  $transformation[$key] = $destination[$key];
  continue;
}

If we actually unset the value, it works (but maybe there was a reason for the assign statement ??? )

if ($match === TRUE) {
  unset($transformation[$key]);
  continue;
}

Remaining tasks

-

User interface changes

-

API changes

-

Data model changes

-

🐛 Bug report
Status

Active

Version

3.0

Component

Code

Created by

🇧🇪Belgium kriboogh

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

  • Issue created by @kriboogh
  • Status changed to Postponed: needs info about 2 months ago
  • 🇨🇭Switzerland bircher 🇨🇿

    I think this is a misunderstanding of what "ignore" means.
    When you ignore something it will not be removed or "unset", this is the same for whole config entities/objects or keys therein.
    When something is ignored it means that it will be left unchanged. So if it is there it will remain the same, if it was missing it will not be added. So if you look at what the code is doing, it is preparing the transformation storage so that when the destination is replaced by the transformation storage it will have that effect. So when something is ignored and it exists in the destination it will be used to set it in the transformation and if it doesn't exist in the destination it will be unset in the transformation.

    If you want a different behaviour then you will have to create your own config transformation.

    I set this to "maintainer needs more info" in case I misunderstood this issue. otherwise I will close it eventually.

Production build 0.71.5 2024