Update Config Enforce Devel hooks to work with latest Config Devel issue fork

Created on 3 March 2023, almost 3 years ago

Problem/Motivation

Now that work on Define hooks to provide 'auto_import' and 'auto_export' Needs review has finally moved forward, the format that Config Enforce Devel provides config files to the new Config Devel auto import hook is having unexpected fatal errors. These seem to be caused by Config Enforce Devel's hook returning an array with config names as keys, while Config Devel saves auto import as a sequence, i.e. not a map but a numerically indexed array. Why is this significant? Because the updated/refactored Config Devel auto import hook now passes what we return to Drupal's configuration system, which in turn interprets the dot separator (.) in the key name as a multi-level config, which is then saved as a nested array when in fact Config Devel expects it to be a flat sequence. To illustrate:

[
  'enforced.config.item' => [
    'filename'  => '...',
    'hash'      => '...',
  ],
]

gets parsed and saved to config storage as:

[
  'enforced' => [
    'config' => [
      'item' => [
        'filename'  => '...',
        'hash'      => '...',
      ],
    ],
  ],
]

which which ends up causing fatal errors.

Steps to reproduce

Check out latest Config Devel from Define hooks to provide 'auto_import' and 'auto_export' Needs review and current dev Config Enforce Devel. Try to add some enforced config. Behold, a wild white screen of death appears.

Proposed resolution

Part of the fix should be to contribute an \array_values() around the return value of the hooks and/or some better error checking in Config Devel so that it doesn't save a badly structured array. That only solves part of the problem, because Config Enforce Devel depends on the string array keys to figure out what

Remaining tasks

Update our code to work with the updated import hooks.

User interface changes

None.

API changes

None?

Data model changes

Probably none? Unsure.

🐛 Bug report
Status

Active

Version

1.0

Component

Code

Created by

🇨🇦Canada ambient.impact Toronto

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

Merge Requests

Comments & Activities

Production build 0.71.5 2024