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.

git-svn-id: https://develop.svn.wordpress.org/trunk@52804 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Sergey Biryukov 2022-02-26 14:26:21 +00:00
parent b00eda0e0f
commit e537f7cddf

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.