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 1173Backtrace:
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 NULLFix:
Replace by
get_bloginfo()
inincludes/function.php
:$feed_url_template = add_query_arg( 's', 'searchTerms', get_bloginfo( "{$feed}_url" ) );
Thanks for the fix,
Marc
- The topic ‘PHP deprecated: strstr(): Passing null to parameter’ is closed to new replies.