diff --git a/src/InitOptions.php b/src/InitOptions.php index 8a108fc8..e6f0de70 100644 --- a/src/InitOptions.php +++ b/src/InitOptions.php @@ -125,10 +125,13 @@ public function maybe_exclude_pageview( $options = [] ) { /** * This a seam for @see add_query_arg() to be mocked in unit tests. * + * @since 2.6.2 Uses add_query_arg( [] ) instead of add_query_arg( null, null ): both return the current request URI, + * but the latter uses null as an array offset, which is deprecated since PHP 8.5. + * * @codeCoverageIgnore */ protected function get_current_request() { - return add_query_arg( null, null ); + return add_query_arg( [] ); } /** diff --git a/src/Integrations/Search.php b/src/Integrations/Search.php index 4a6304bd..249ce406 100644 --- a/src/Integrations/Search.php +++ b/src/Integrations/Search.php @@ -58,9 +58,11 @@ public function maybe_add_hidden_input_to_search_form( $form ) { * * The scheme and host are taken from the configured home_url() so the referrer stays correct behind reverse * proxies (where is_ssl() can be unreliable). The path and query come straight from the current request - * (add_query_arg( null, null )), which already includes any subdirectory the site is installed in. Passing that - * request URI through home_url() instead would prepend the home path a second time, duplicating the subdirectory - * on subdirectory installs (e.g. https://example.com/dev/dev/...). + * (add_query_arg( [] )), which already includes any subdirectory the site is installed in. Passing that request + * URI through home_url() instead would prepend the home path a second time, duplicating the subdirectory on + * subdirectory installs (e.g. https://example.com/dev/dev/...). + * + * add_query_arg( null, null ) returns the same, but uses null as an array offset, which is deprecated since PHP 8.5. * * @return string The sanitized referrer URL or an empty string if unavailable. * @@ -76,7 +78,7 @@ private function get_referrer() { return ''; } - $referrer = esc_url( $scheme . '://' . $host . $port . add_query_arg( null, null ) ); + $referrer = esc_url( $scheme . '://' . $host . $port . add_query_arg( [] ) ); if ( ! $referrer ) { $referrer = '';