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

Created on 13 August 2024, 5 months ago

Problem/Motivation

TypeError: count(): Argument #1 ($value) must be of type Countable|array, string given in count() (line 136 of modules/contrib/draggable_dashboard/src/Form/DashboardForm.php).

Steps to reproduce

After updating to D10 go to /admin/structure/draggable-dashboard and edit the existing dashboard.

Proposed resolution

Decode blocks entities before passing it to count().

 $entities = $dashboard->get('blocks') ?? [];
$entities = is_string($entities) ? json_decode($entities) : [];
🐛 Bug report
Status

Closed: works as designed

Component

Code

Created by

🇩🇪Germany majid.ali

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