ConfigManager::findConfigEntityDependenciesAsEntities() should not load config overrides

Created on 13 December 2022, about 2 years ago
Updated 28 June 2023, over 1 year ago

Problem/Motivation

We noticed a problem with config_split when exporting a split containing config that is overridden : the override is exported in the YAML file.
This happens because ConfigSplitManager::splitPreview() calls ConfigManager::getConfigEntitiesToChangeOnDependencyRemoval() which then calls ConfigManager::findConfigEntityDependenciesAsEntities() and it returns config containing our override.

Steps to reproduce

Here is how we noticed it:

  • Install config_split 2.
  • Create a complete split on a specific config that has a corresponding permission (the permission must depend on the splitted configuration).
  • Force the permission in settings.php like this:
    $config['user.role.anonymous']['permissions'][9999] = 'my permission'; 
  • Run drush cex.
  • The permission is added to the export.

Proposed resolution

findConfigEntityDependenciesAsEntities() uses loadMultiple() and I think it should use loadMultipleOverrideFree() instead.
If I understand correctly, this method is used to know which config needs to be deleted or changed when deleting config or uninstalling a module. Drupal will not be able to delete or change the overrides defined in code so it does not make sense to return them here.

API changes

If findConfigEntityDependenciesAsEntities() is used by some contrib modules, we might need to add a new $loadOverrides = FALSE argument in order to not change the default behavior.

πŸ› Bug report
Status

Needs work

Version

9.5

Component
ConfigurationΒ  β†’

Last updated about 17 hours ago

Created by

πŸ‡«πŸ‡·France prudloff Lille

Live updates comments and jobs are added and updated live.
  • Needs tests

    The change is currently missing an automated test that fails when run with the original code, and succeeds when the bug has been fixed.

Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.71.5 2024