Argument #1 ($value) must be of type Countable|array, null given in count() (line 57 of core/lib/Drupal/Core/Render/Element/Radios.php).

Created on 2 December 2021, almost 3 years ago
Updated 19 September 2024, about 2 months ago

Problem/Motivation

The website encountered an error thrown when options are blank.

Steps to reproduce

  1. Create a custom form.
  2. Add a field of type radios/checkbox/tableselect.
  3. Make the option to be NULL.
  4. This can also be reproduced if we use a blank taxonomy term as an exposed filter in view.

Proposed resolution

Added a condition to check the options that exist and is_countable for radios/checkbox/table/tableselect.

Remaining tasks

Write tests
Review

User interface changes

N/A

API changes

N/A

Data model changes

N/A

🐛 Bug report
Status

Needs work

Version

11.0 🔥

Component
Render 

Last updated 3 days ago

Created by

fathima.asmat London, UK

Live updates comments and jobs are added and updated live.
  • Needs tests

    The change is currently missing an automated test that fails when run with the original code, and succeeds when the bug has been fixed.

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