Fix PHP 8.1 Deprecated function: strpos()

Created on 13 July 2025, 21 days ago

Problem/Motivation

When visiting any page with a null route, these errors appear:

  • Deprecated function: strpos(): Passing null to parameter #1 ($haystack) of type string is deprecated in Drupal\blazy\BlazyManagerBase->preSettings() (line 220 of modules/contrib/blazy/src/BlazyManagerBase.php).
  • Deprecated function: strpos(): Passing null to parameter #1 ($haystack) of type string is deprecated in Drupal\blazy\BlazyManagerBase->preSettings() (line 220 of modules/contrib/blazy/src/BlazyManagerBase.php).
  • Deprecated function: strpos(): Passing null to parameter #1 ($haystack) of type string is deprecated in Drupal\blazy\BlazyManagerBase->preSettings() (line 220 of modules/contrib/blazy/src/BlazyManagerBase.php).

Steps to reproduce

Go to any page not found

Proposed resolution

Change the code from if (strpos($route_name, 'layout_builder.') !== FALSE) { to if (is_string($route_name) && strpos($route_name, 'some-string') !== FALSE) {

Remaining tasks

User interface changes

API changes

Data model changes

🐛 Bug report
Status

Active

Version

3.0

Component

Code

Created by

🇯🇴Jordan yousefanbar Zarqa

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

Comments & Activities

Production build 0.71.5 2024