Applied configuration don't registered

Created on 17 September 2024, 5 months ago
Updated 18 September 2024, 5 months ago

Problem/Motivation

I created a config-modify file in a custom module and it should be executed after they installation. When the module is enabled the configuration is being applied, but the filename isn't be registered as applied and when executed again, the configuration is duplicated.

The error happen at: html/modules/contrib/config_modify/src/ConfigInstaller.php:142

$alterations_applied->set("files", $alterations_applied->get("files") + $config_to_alter)->save();

Looking this documentation: https://www.amitmerchant.com/two-ways-to-merge-arrays-in-php/, should be better use array_merge for this code, because using "+" the union is assossiative and can hide some items when both array has the same key.

Steps to reproduce

  • Create config-modify file in a module
  • Execute config-modify and check the applied-configuration
  • As the configuration isn't be saved at applied-configuration, it will be executed again and duplicated the configuration

Proposed resolution

Replace "+" as union and use array_merge function.

Remaining tasks

N/A

User interface changes

N/A

API changes

N/A

Data model changes

N/A

🐛 Bug report
Status

Needs review

Version

1.1

Component

Code

Created by

🇧🇷Brazil viniciusrp

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