On PHP 8.1: TypeError: count(): Argument #1 ($value) must be of type Countable|array, bool given in _filter_url()

Created on 8 June 2023, about 1 year ago
Updated 29 August 2023, 10 months ago

Problem/Motivation

Site is throwing an error if we try to rebuild permissions.

Error message: TypeError: count(): Argument #1 ($value) must be of type Countable|array, bool given in _filter_url() (line 1532 of /../../../modules/filter/filter.module).

Steps to reproduce

Just log in to your Drupal application and try rebuilding the permissions from the status page.
PHP Version - 8.1
Drupal Version - 7.97

Proposed resolution

need to change the below lines on filter.module in the core
line 1532
for ($i = 0; $i < count($chunks); $i++) {
to
for ($i = 0; $chunks && $i < count($chunks); $i++) {

line 1563
$text = implode($chunks);
to
$text = $chunks ? implode($chunks) : $text;

Remaining tasks

User interface changes

API changes

Data model changes

Release notes snippet

🐛 Bug report
Status

Closed: duplicate

Version

7.0 ⚰️

Component
Filter 

Last updated about 16 hours ago

No maintainer
Created by

🇺🇸United States manoj.surala

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

Comments & Activities

Production build 0.69.0 2024