WordPress/wp-includes/sitemaps
Sergey Biryukov e53ffbaf95 Code Modernization: Pass correct default value to `http_build_query()` in `WP_Sitemaps_Provider::get_sitemap_url()`.
The `WP_Sitemaps_Provider::get_sitemap_url()` method calls the PHP native `http_build_query()` function, the second parameter of which is the ''optional'' `$numeric_prefix` parameter which expects a `string`.

A parameter being optional, however, does not automatically make it nullable.

As of PHP 8.1, passing `null` to a non-nullable PHP native function will generate a deprecation notice.

In this case, this function call yielded a `http_build_query(): Passing null to parameter #2 ($numeric_prefix) of type string is deprecated` notice.

Changing the `null` to an empty string fixes this without a backward compatibility break.

This change is already covered by tests as 14 of the existing tests failed on these function calls when running the tests on PHP 8.1.

References:
* [https://www.php.net/manual/en/function.http-build-query.php PHP Manual: http_build_query()]
* [https://wiki.php.net/rfc/deprecate_null_to_scalar_internal_arg PHP RFC: Deprecate passing null to non-nullable arguments of internal functions]

Follow-up to [48470].

Props jrf.
See #53635.
Built from https://develop.svn.wordpress.org/trunk@51652


git-svn-id: http://core.svn.wordpress.org/trunk@51258 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-08-23 11:44:01 +00:00
..
providers Sitemaps: Check the result of `get_term_link()` when collecting the URLs in `WP_Sitemaps_Taxonomies::get_url_list()`. 2020-10-13 15:04:07 +00:00
class-wp-sitemaps-index.php Sitemaps: Rename 'sitemap' to 'provider' in `WP_Sitemaps_Registry` class. 2020-07-21 15:29:02 +00:00
class-wp-sitemaps-provider.php Code Modernization: Pass correct default value to `http_build_query()` in `WP_Sitemaps_Provider::get_sitemap_url()`. 2021-08-23 11:44:01 +00:00
class-wp-sitemaps-registry.php Sitemaps: Replace `wp_sitemaps_register_providers` filter with more suitable `wp_sitemaps_add_provider` filter. 2020-07-21 16:14:07 +00:00
class-wp-sitemaps-renderer.php Sitemaps: Pass full paths to `home_url()` calls. 2020-07-14 11:43:03 +00:00
class-wp-sitemaps-stylesheet.php Coding Standards: Add a space before `/` character in some self-closing HTML tags. 2021-03-20 18:30:08 +00:00
class-wp-sitemaps.php Docs: Various formatting improvements to inline docblocks. 2020-07-23 00:52:05 +00:00