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

Created on 11 August 2022, about 2 years ago
Updated 9 May 2024, 4 months ago

Problem/Motivation

When using PHP 8.1 I was getting the following warning.

Deprecated function: stripos(): Passing null to parameter #1 ($haystack) of type string is deprecated in Drupal\beautify\EventSubscriber\BeautifyResponseFilter->onResponse() (line 72 of /app/web/modules/contrib/beautify/src/EventSubscriber/BeautifyResponseFilter.php)

Steps to reproduce

  1. Using Drupal 10.1.0-dev
  2. With PHP 8.1
  3. Install Beautify module
  4. Install Tidy PHP extension
  5. Set Default HTML Beautifier to Tidy
  6. Refresh a page, and see the entries in the log

Proposed resolution

Explicitly cast the argument since null will return an empty string.

🐛 Bug report
Status

Fixed

Version

1.0

Component

Code

Created by

🇩🇰Denmark ressa Copenhagen

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

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.71.5 2024