Problem/Motivation

Hi! When I go to /admin/config/counter/initial and try to save the configurations, my site breaks and I got the following error message:

The website encountered an unexpected error. Please try again later.
Drupal\Core\Config\ImmutableConfigException: Can not set values on immutable configuration counter.settings:counter_initial_counter. Use \Drupal\Core\Config\ConfigFactoryInterface::getEditable() to retrieve a mutable configuration object in Drupal\Core\Config\ImmutableConfig->set() (line 27 of core/lib/Drupal/Core/Config/ImmutableConfig.php).

I'm using Drupal 9.3.6 version.

Steps to reproduce

1) Go to /admin/config/counter/initial
2) Change the configurations that you want
3) Try to save

You will see the error message.

Proposed resolution

Get the config of the right way.
I was searching for solutions and I think use getEditable is the right way to solve this.

CommentFileSizeAuthor
#2 3269455-2.patch404 byteslarisse

Comments

larisse created an issue. See original summary.

larisse’s picture

Assigned: larisse » Unassigned
Status: Active » Needs review
StatusFileSize
new404 bytes

Oh, I notice that just add the config name in getEditableConfigNames function was sufficient to be able to save the changes. Here's a patch.

Guilherme Rabelo’s picture

Guilherme Rabelo’s picture

Guilherme Rabelo’s picture

Guilherme Rabelo’s picture

Assigned: Unassigned » Guilherme Rabelo

I don't know what happens with this all comments lol, but i will review this patch.

Guilherme Rabelo’s picture

Assigned: Guilherme Rabelo » Unassigned
Status: Needs review » Reviewed & tested by the community

This last patch fixe the problem. Now its possible to save the initial configuration changes.
Moving to RTBC

gaurav.kapoor’s picture

Thanks, @larisse and @Guilherme Rabelo for working on this. I have removed counter.initial array key and replaced it with counter.settings.

  • larisse authored 78a6951 on 8.x-1.x
    Issue #3269455 by larisse, Guilherme Rabelo, gaurav.kapoor: Can not set...
gaurav.kapoor’s picture

Status: Reviewed & tested by the community » Fixed

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.