Cannot load DS settings page (TypeError: implode(): Argument #1 ($pieces) must be of type array, string given in implode() (line 223 of modules/contrib/ds/modules/ds_extras/ds_extras.module).)

Created on 24 August 2023, over 1 year ago
Updated 22 December 2023, 12 months ago

Problem/Motivation

Cannot load the settings page due to error:

TypeError: implode(): Argument #1 ($pieces) must be of type array, string given in implode() (line 223 of modules/contrib/ds/modules/ds_extras/ds_extras.module).

The problem is that the `ds_extras.settings` configuration was never created on our site (not sure why/how). The `ds_extras_form_ds_admin_form_alter` hook in the `ds_extras.module` file loads the `ds_extras.settings` config and attempts to use the values as default values:

line 203 $config = \Drupal::configFactory()->getEditable('ds_extras.settings');
line 223 '#default_value' => implode("\n", $config->get('fields_extra_list')),

The `$config->get('fields_extra_list')` line returns NULL, which produces the fatal error.

Steps to reproduce

1. Navigate to `/admin/structure/ds/settings` and see the error.

Proposed resolution

I do not know how to fix this in code or whether it affects most people. I wasn't sure whether to make a bug or a support request. It's entirely possible we did not run an update correctly in the past and missed when this configuration was installed/created.

I resolved it myself by manually removing the default values from the form and saving the file. I was then able to load the form, save it, and create values for `ds_extras.settings` (and export them to a YML). Now I'm able to load the original form fine.

Remaining tasks

User interface changes

API changes

Data model changes

🐛 Bug report
Status

Fixed

Version

3.15

Component

Code

Created by

🇺🇸United States joegl

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

Comments & Activities

Production build 0.71.5 2024