Problem/Motivation

If there are no lists checked on the "Constant Contact Available Lists" page (admin/config/services/ik-constant-contact/lists), then adding the "Constant Contact Multiple Lists Signup Form" block will lead to a HTTP 500 status with this error:

TypeError: count(): Argument #1 ($value) must be of type Countable|array, null given in count() (line 64 of /var/www/html/dv8.openplus.ca/html/core/lib/Drupal/Core/Render/Element/Checkboxes.php).

Steps to reproduce

Add a block while there are no lists check on admin/config/services/ik-constant-contact/lists.

Proposed resolution

Make the code robust against an empty value.

Remaining tasks

Implement.

User interface changes

Avoids a HTTP 500 status.

API changes

None.

Data model changes

None.

Command icon 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

liam morland created an issue. See original summary.

rosemaryreilman’s picture

Assigned: Unassigned » rosemaryreilman

rosemaryreilman’s picture

Status: Active » Needs review

I created a PR to see if just adding an empty options array will suffice. It may not since the default value = NULL if there's no other config set. It may error but I'm unable to test it at the moment. Marking as needing review. If you have a chance and can use the patch from the PR, let me know if that clears the error for you. Thank you!

liam morland’s picture

Status: Needs review » Reviewed & tested by the community

This seems to have fixed it for me.

rosemaryreilman’s picture

Status: Reviewed & tested by the community » Fixed

Fixed in 4.2.3

rosemaryreilman’s picture

Status: Fixed » Closed (fixed)
liam morland’s picture

This wasn't merged.

rosemaryreilman’s picture

Ack, sorry about that. Created 4.2.4.

liam morland’s picture

Thanks. There are some previous tags left behind by this in the main repo.