Deprecation notice: passing NULL to preg_replace

Created on 1 August 2023, almost 2 years ago
Updated 20 October 2023, over 1 year ago

Problem/Motivation

Spotted this deprecation notice on a Drupal 9 site that we're working on.

Deprecated: preg_replace(): Passing null to parameter #2 ($replacement) of type array|string is deprecated in /data/app/modules/contrib/funnelback/src/FunnelbackQueryString.php on line 100

This is on the most recent Funnelback 1.x-dev, on PHP 8.1.19.

Steps to reproduce

  1. Set up site on PHP 8.1.19
  2. Install Funnelback
  3. Access /admin/config

Proposed resolution

Change the NULL in the following to an empty string.

// Remove '[]' from facet query for funnelback.
$strQuery = preg_replace("/\\[(.*?)\\]/", NULL, $strQuery);

Remaining tasks

Provide patch.

User interface changes

None.

API changes

None.

Data model changes

None.

🐛 Bug report
Status

Fixed

Version

1.0

Component

Code

Created by

🇦🇺Australia geoffreyr Sydney, AU / Gadigal country

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

Comments & Activities

Production build 0.71.5 2024