TypeError: implode(): Argument #1 ($pieces) must be of type array, string given in implode() (line 81 of modules/contrib/cas_attributes/src/Form/CasAttributesSettings.php). with PHP 8

Created on 1 December 2022, almost 2 years ago
Updated 15 May 2024, 4 months ago

Problem/Motivation

implode() function on line 81 of cas_attributes/src/Form/CasAttributesSettings.php uses $config->get('token_allowed_attributes') without checking if it is null. null values cause implode to halt.

Steps to reproduce

PHP8, Drupal 9, browse to /admin/config/people/cas/attributes

Proposed resolution

Check for null values in 'token_allowed_attributes' before using it in implode()

e.g.
...
$token_allowed_attributes = is_null($config->get('token_allowed_attributes')) ? array() : $config->get('token_allowed_attributes');
...
'#default_value' => implode("\n", $token_allowed_attributes),
...

πŸ› Bug report
Status

Needs review

Version

2.0

Component

CAS Attributes

Created by

πŸ‡ΊπŸ‡ΈUnited States naidim

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.

Production build 0.71.5 2024