Deprecated function: str_starts_with(): Passing null to parameter #1 ($haystack) of type string is deprecated

Created on 8 September 2023, 10 months ago
Updated 24 January 2024, 5 months ago

Problem/Motivation

We are getting deprecation notices on 404 pages

Deprecated function: str_starts_with(): Passing null to parameter #1 ($haystack) of type string is deprecated in Drupal\views\Plugin\views\display\DisplayPluginBase->viewExposedFormBlocks() (line 2642 of core/modules/views/src/Plugin/views/display/DisplayPluginBase.php).

It seems that in the function viewExposedFormBlocks it checks the route name to avoid views_ui. routes, but when \Drupal::routeMatch()->getRouteName() returns null it throws the deprecation notice in str_starts_with.

We are running PHP 8.1 with D10.1.2

Steps to reproduce

todo

Proposed resolution

Check the variable is not empty.

Remaining tasks

/

User interface changes

/

API changes

/

Data model changes

/

Release notes snippet

/

🐛 Bug report
Status

Needs work

Version

10.1

Component
Views 

Last updated 8 minutes ago

Created by

🇧🇪Belgium leanderjcc Ghent

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

Comments & Activities

Production build 0.69.0 2024