[PHP 8.1] Deprecated function: strtolower(): Passing null to parameter #1 ($string) of type string is deprecated in apachesolr_search_get_search_suggestions()

Created on 4 March 2025, about 1 month ago

Problem/Motivation

I know this project is pretty dead and not maintained anymore, but I've come across this warning when an user tries to do a an empty search (for example https://mysite.com/search/site/ ) and the "word suggestions" functionality is on, I get this warning:

Deprecated function: strtolower(): Passing null to parameter #1 ($string) of type string is deprecated in apachesolr_search_get_search_suggestions() (line 1425 of /docroot/sites/all/modules/contrib/apachesolr/apachesolr_search.module).

Steps to reproduce

Check details below

Proposed resolution

Check if $query->getParam('q') is empty, something like

$keyword = strtolower($query->getParam('q') ?? '');

Remaining tasks

Provide a patch for this.

User interface changes

API changes

Data model changes

🐛 Bug report
Status

Active

Version

1.0

Component

Code

Created by

🇨🇦Canada danrod Ottawa

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

Production build 0.71.5 2024