Better default values in WP_Query::get_queried_object().

Setting the default value of the `queried_object_id` property to `0` meant
that, when called early enough in the WP bootstrap, `get_queried_object()`
could short-circuit the normal query by fooling it into thinking that the
request was for a page with id 0. Setting the default value to `null` instead
avoids this problem.

Props gradyetc, jazbek.
Fixes #31355.
Built from https://develop.svn.wordpress.org/trunk@34073


git-svn-id: http://core.svn.wordpress.org/trunk@34041 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Boone Gorges 2015-09-12 03:37:23 +00:00
parent 4dbaf63b67
commit 1a203b5328
2 changed files with 2 additions and 2 deletions

View File

@ -3926,7 +3926,7 @@ class WP_Query {
return $this->queried_object;
$this->queried_object = null;
$this->queried_object_id = 0;
$this->queried_object_id = null;
if ( $this->is_category || $this->is_tag || $this->is_tax ) {
if ( $this->is_category ) {

View File

@ -4,7 +4,7 @@
*
* @global string $wp_version
*/
$wp_version = '4.4-alpha-34072';
$wp_version = '4.4-alpha-34073';
/**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.