- 🇬🇧United Kingdom Alina Basarabeanu
Using Drupal core version 9.5.9 with Config Log 3.0.2 I can't access the /admin/config/development/config_log form because of the following error:
TypeError: implode(): Argument #1 ($pieces) must be of type array, string given in implode() (line 80 of /var/www/html/docroot/modules/contrib/config_log/src/Form/ConfigLogConfigForm.php)
Applying the patch from #3 fixes it.
- 🇵🇹Portugal nsalves
I believe a better approach would be to verify the value of the config entry and if it was empty then return an empty string. Patch attached with this approach
- last update
about 1 year ago 10 pass - 🇦🇺Australia VladimirAus Brisbane, Australia
I'm getting the following error on PHP 8.3 and Drupal 10.3
TypeError: implode(): Argument #1 ($array) must be of type array, string given in implode() (line 87 of /app/web/modules/contrib/config_log/src/Form/ConfigLogConfigForm.php).
See similar issues: 🐛 TypeError: implode(): Argument #1 ($pieces) must be of type array, string given in implode() (line 29 of /app/web/core/lib/Drupal/Core/Form/FormElementHelper.php) Needs work , 🐛 TypeError : implode(): Argument #1 ($pieces) must be of type array, string given dans implode() (*/web/modules/contrib/pathauto/src/Form/PathautoSettingsForm.php ligne 255) Fixed
MR is open.
- Issue was unassigned.
- Status changed to Needs review
6 months ago 1:00am 18 August 2024 - Status changed to Needs work
6 months ago 7:48am 18 August 2024 - 🇭🇺Hungary nagy.balint
Hi!
The only way that you would get a string in your config is if you have a string in your log_ignored_config config, which is a sequence, so it is either NULL or an array.
Also the Config class' get method returns NULL when the value does not exist, which the implode has no problem with.
I still cannot reproduce it on a fresh install.
But of course we can put a check there likely it would be better to put:
+ $log_ignored_config = $config_log_conf->get('log_ignored_config'); + $form['options']['log_ignored_config'] = [ '#type' => 'textarea', '#rows' => 25, '#title' => $this->t('Configuration entity names to ignore'), '#description' => $description, - '#default_value' => implode(PHP_EOL, $config_log_conf->get('log_ignored_config')), + '#default_value' => (is_array($log_ignored_config) ? implode(PHP_EOL, $log_ignored_config) : ''), '#size' => 60, ];
As it is not enough to check if the value exist, but also whether it is an array.
-
nagy.balint →
committed c48738d5 on 4.x
Issue #3294373 by apettigrew, vladimiraus, nsalves, nagy.balint: Better...
-
nagy.balint →
committed c48738d5 on 4.x
- Status changed to Fixed
6 months ago 4:44pm 18 August 2024 Automatically closed - issue fixed for 2 weeks with no activity.