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

Created on 15 June 2023, over 1 year ago

Problem/Motivation

After updating to Drupal 10, the following error occurs:

TypeError: count(): Argument #1 ($value) must be of type Countable|array, stdClass given in template_preprocess_we_megamenu_li() (line 399 of the file /var/www/html/htdocs/modules/contrib/we_megamenu/we_megamenu.module).

Steps to reproduce

Use subtree block in Drupal 10.

Proposed resolution

The error message suggests that the argument passed to the count() function is expected to be either an array or a Countable object, but it's receiving an stdClass object instead. To fix this error, you need to ensure that the value passed to count() is a valid array or Countable object.

🐛 Bug report
Status

Needs review

Version

1.0

Component

Code

Created by

🇨🇿Czech Republic pjanda Teplice

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

Comments & Activities

Production build 0.71.5 2024