TypeError: count(): Argument #1 ($value) must be of type Countable|array

Created on 27 June 2025, 7 days ago

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.

πŸ› Bug report
Status

Active

Version

4.0

Component

Code

Created by

πŸ‡¨πŸ‡¦Canada Liam Morland Ontario, CA πŸ‡¨πŸ‡¦

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