Query: Preinitialize the `WP` class properties to their default values.

This avoids an `array_keys() expects parameter 1 to be array, null given` PHP warning for the `query_vars` property in `WP::build_query_string()` when disabling request parsing via the `do_parse_request` filter.

Props dd32, SergeyBiryukov.
Fixes #55222.
Built from https://develop.svn.wordpress.org/trunk@52804


git-svn-id: http://core.svn.wordpress.org/trunk@52393 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Sergey Biryukov 2022-02-26 14:28:01 +00:00
parent e89229886b
commit a47961e80e
2 changed files with 6 additions and 6 deletions

View File

@ -40,7 +40,7 @@ class WP {
* @since 2.0.0
* @var array
*/
public $query_vars;
public $query_vars = array();
/**
* String parsed to set the query variables.
@ -48,7 +48,7 @@ class WP {
* @since 2.0.0
* @var string
*/
public $query_string;
public $query_string = '';
/**
* The request path, e.g. 2015/05/06.
@ -56,7 +56,7 @@ class WP {
* @since 2.0.0
* @var string
*/
public $request;
public $request = '';
/**
* Rewrite rule the request matched.
@ -64,7 +64,7 @@ class WP {
* @since 2.0.0
* @var string
*/
public $matched_rule;
public $matched_rule = '';
/**
* Rewrite query the request matched.
@ -72,7 +72,7 @@ class WP {
* @since 2.0.0
* @var string
*/
public $matched_query;
public $matched_query = '';
/**
* Whether already did the permalink.

View File

@ -16,7 +16,7 @@
*
* @global string $wp_version
*/
$wp_version = '6.0-alpha-52802';
$wp_version = '6.0-alpha-52804';
/**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.