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.

CommentFileSizeAuthor
#4 before_MR_.png49.54 KBdineshkumarbollu

Issue fork funnelback-3378369

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

geoffreyr created an issue. See original summary.

geoffreyr’s picture

Assigned: geoffreyr » Unassigned
Status: Active » Needs review
dineshkumarbollu’s picture

StatusFileSize
new49.54 KB

Hi
I tested the MR it fixes error in log, but after MR one new warning is getting while Accessing the (admin/config/search/funnelback).

Warning: file_get_contents(libraries/CryptoJS/aes.js): Failed to open stream: No such file or directory in Drupal\Core\Asset\JsOptimizer->optimize() (line 25 of /var/www/html/contributions/web/core/lib/Drupal/Core/Asset/JsOptimizer.php)

keshavv’s picture

Status: Needs review » Reviewed & tested by the community

The fix that is mentioned in the MR is correct but it will not relate to Warning: file_get_contents().
We can reconfirm and create a separate issue for it.
But for preg_replace() MR will wok. We can merge it.
Thank you.

larowlan made their first commit to this issue’s fork.

  • larowlan committed bf629798 on 8.x-1.x authored by geoffreyr
    Issue #3378369: Deprecation notice: passing NULL to preg_replace
    
larowlan’s picture

Version: 8.x-1.x-dev » 2.x-dev

Moving to 2.x

  • larowlan committed d4f21e6e on 2.x authored by geoffreyr
    Issue #3378369: Deprecation notice: passing NULL to preg_replace
    
    (...
larowlan’s picture

Version: 2.x-dev » 8.x-1.x-dev
Status: Reviewed & tested by the community » Fixed

Put into both branches, thanks

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.