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
- Set up site on PHP 8.1.19
- Install Funnelback
- 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.
Comments
Comment #3
geoffreyr commentedComment #4
dineshkumarbollu commentedHi
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)Comment #5
keshavv commentedThe 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.
Comment #8
larowlanMoving to 2.x
Comment #10
larowlanPut into both branches, thanks