Implode doesn't work for ConfigLogConfigForm.php

Created on 5 July 2022, almost 2 years ago
Updated 17 December 2023, 6 months ago

Problem/Motivation

Cannot access admin/config/development/config_log due to TypeError: implode(): Argument #1 ($pieces) must be of type array, string given in implode() (line 80 of /app/docroot/modules/contrib/config_log/src/Form/ConfigLogConfigForm.php)

Steps to reproduce

1. Install Config_log module on PHP 8.0+ and Drupal 9.3.17+
2. Enable Config_log module
3. Navigate to Config_log module configuration page (admin/config/development/config_log)
4. Result is: "The website encountered an unexpected error. Please try again later."

Proposed resolution

1. update line 80 of src/Form/ConfigLogConfigForm.php from:
'#default_value' => implode(PHP_EOL, $config_log_conf->get('log_ignored_config')),
to:
'#default_value' => preg_split("/\\r\\n|\\r|\\n/", $_GET['log_ignored_config']),

Remaining tasks

1. Review and testing by community

User interface changes

1. None

API changes

1. None

Data model changes

1. None

πŸ› Bug report
Status

Postponed: needs info

Version

3.0

Component

Code

Created by

Live updates comments and jobs are added and updated live.
  • PHP 8.0

    The issue particularly affects sites running on PHP version 8.0.0 or later.

Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • πŸ‡¬πŸ‡§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

  • Open in Jenkins β†’ Open on Drupal.org β†’
    Core: 10.2.1 + Environment: PHP 8.1 & MySQL 8
    last update 4 months ago
    10 pass
Production build 0.69.0 2024