TypeError: count(): Argument #1 ($value) must be of type Countable|array, null given in count() (line 205 of /.../permissions_by_term/modules/permissions_by_entity/src/Service/AccessChecker.php).

Created on 20 September 2023, 9 months ago
Updated 30 January 2024, 5 months ago

Problem/Motivation

When upgrading from 3.1.26 to 3.1.27 I get the following error on (most) page loads:

TypeError: count(): Argument #1 ($value) must be of type Countable|array, null given in count() (line 205 of /.../permissions_by_term/modules/permissions_by_entity/src/Service/AccessChecker.php).

This happens because my permissions_by_term.settings config does not have a target_bundles key. I'm not sure if this is an expected state or just something weird for my configuration? The changes in 🐛 Permissions broken when multiple terms are selected Fixed cause the issue.

Steps to reproduce

  1. Upgrade from 3.1.25 to 3.1.27.
  2. Clear caches.
  3. Navigate to a non-admin page.

Workaround

  1. Authenticate as an admin (may require drush uli if getting WSOD).
  2. Navigate to /admin/permissions-by-term/settings.
  3. Save settings.

Proposed resolution

Add an update hook to add target_bundles key to permissions_by_term.settings if it's missing.

Remaining tasks

User interface changes

API changes

Data model changes

🐛 Bug report
Status

Fixed

Version

3.1

Component

Code

Created by

🇺🇸United States wells Seattle, WA

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

Production build 0.69.0 2024