PHP 8.1 compatibility issues: passing null to strlen() and strpos() is deprecated

Created on 7 August 2023, over 1 year ago
Updated 17 April 2024, 7 months ago

Problem/Motivation

I faced two errors in advagg_parse_media_blocks() when passing NULL as the first arguement:

Deprecated function: strlen(): Passing null to parameter #1 ($string) of type string is deprecated in advagg_parse_media_blocks() (line 1577
Deprecated function: strpos(): Passing null to parameter #1 ($haystack) of type string is deprecated in advagg_parse_media_blocks() (line 1531

Proposed resolution

Add check on existence $css = $css ?? '';

🐛 Bug report
Status

Fixed

Version

2.0

Component

Code

Created by

Live updates comments and jobs are added and updated live.
  • PHP 8.1

    The issue particularly affects sites running on PHP version 8.1.0 or later.

Sign in to follow issues

Merge Requests

Comments & Activities

Production build 0.71.5 2024