Problem/Motivation
Seeing this error happen in the logs semi-frequently:
Uncaught PHP Exception TypeError: "my_module_mailchimp_lists_interest_groups_alter(): Argument #1 ($interests) must be of type array, false given, called in /var/www/prod/csp/site/core/lib/Drupal/Core/Extension/ModuleHandler.php on line 474"
Steps to reproduce
Unsure.
Proposed resolution
This is fairly easy to prevent by doing proper type checking.
This line in mailchimp_lists_process_subscribe_form_choices() uses a null coalescing operator, but that won't do anything if the value is FALSE rather than NULL. I suggest using is_array() instead.
$interests = $choices['interest_groups'] ?? [];
Remaining tasks
User interface changes
API changes
Data model changes
Issue fork mailchimp-3616713
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #6
xenophyle commentedThanks!