PHP deprecated: strstr(): Passing null to parameter

PHP 8.1, Open-Search 4.1.0

I’m getting multiple PHP Deprecated warnings when using Open Search:

[16-Jan-2024 16:31:44 UTC] PHP Deprecated: strstr(): Passing null to parameter #1 ($haystack) of type string is deprecated in /.../wp-includes/functions.php on line 1153
[16-Jan-2024 16:31:44 UTC] PHP Deprecated: stripos(): Passing null to parameter #1 ($haystack) of type string is deprecated in /.../wp-includes/functions.php on line 1160
[16-Jan-2024 16:31:44 UTC] PHP Deprecated: stripos(): Passing null to parameter #1 ($haystack) of type string is deprecated in /.../wp-includes/functions.php on line 1163
[16-Jan-2024 16:31:44 UTC] PHP Deprecated: str_contains(): Passing null to parameter #1 ($haystack) of type string is deprecated in /.../wp-includes/functions.php on line 1170
[16-Jan-2024 16:31:44 UTC] PHP Deprecated: str_contains(): Passing null to parameter #1 ($haystack) of type string is deprecated in /.../wp-includes/functions.php on line 1173

Backtrace:

0 /wp-content/plugins/open-search-document/includes/functions.php(52): add_query_arg('s', 'searchTerms', NULL)
1 /wp-content/plugins/open-search-document/templates/open-search-document.php(8): OpenSearchDocument\feed_url_template('atom')

Root cause:

Incorrect use of bloginfo() which always returns NULL

Fix:

Replace by get_bloginfo() in includes/function.php:

$feed_url_template = add_query_arg( 's', 'searchTerms', get_bloginfo( "{$feed}_url" ) );

Thanks for the fix,
Marc

 

This site will teach you how to build a WordPress website for beginners. We will cover everything from installing WordPress to adding pages, posts, and images to your site. You will learn how to customize your site with themes and plugins, as well as how to market your site online.

Buy WordPress Transfer