Warning: Undefined array key "interest_groups" in MailchimpListsSelectWidget->setupInterestGroups()

Created on 25 September 2024, about 2 months ago

Problem/Motivation

When logging in using drush uri as an administrator, I get the following error:
Warning: Undefined array key "interest_groups" in Drupal\mailchimp_lists\Plugin\Field\FieldWidget\MailchimpListsSelectWidget->setupInterestGroups() (line 186 of /app/web/modules/contrib/mailchimp/modules/mailchimp_lists/src/Plugin/Field/FieldWidget/MailchimpListsSelectWidget.php)

Steps to reproduce

Do not have any interest groups and log in to the website using the drush uli command.

Proposed resolution

Change the line

$groups_default = $instance->getValue()['interest_groups'] ? $instance->getValue()['interest_groups'] : [];

to

$groups_default = array_key_exists('interest_groups', $instance->getValue()) ? $instance->getValue()['interest_groups'] : [];

to avoid receiving a warning when attempting to access a value from a non-existent array key.

Remaining tasks

User interface changes

API changes

Data model changes

πŸ› Bug report
Status

Active

Version

2.2

Component

Lists Module

Created by

πŸ‡ΊπŸ‡¦Ukraine EvilArgest

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

Merge Requests

Comments & Activities

Production build 0.71.5 2024