Incorrect default value for role filter in UserSelection

Created on 29 August 2024, 3 months ago

Problem/Motivation

When adding an user entity reference field with the option to filter by role, I'm getting the following error under certain circumstances.

PHP message: PHP Warning:  foreach() argument must be of type array|object, null given in core/lib/Drupal/Core/Render/Element/Checkboxes.php on line 113

Steps to reproduce

I haven't been able to reproduce it on a vanilla install yet :) I believe it has to do with saving the form with partial config or switching between a "Default" and "Views" reference method on the form. It is impacting the field configuration form as well as the views filter form.

Proposed resolution

Set the default configuration value to an empty array instead of null.

Remaining tasks

Determine how to reproduce and decide if default value should be an empty array.

🐛 Bug report
Status

Needs work

Version

11.0 🔥

Component
User module 

Last updated about 18 hours ago

Created by

🇺🇸United States andyg5000 North Carolina, USA

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

Merge Requests

Comments & Activities

Production build 0.71.5 2024