[wp-trac] [WordPress Trac] #14976: WP_Query's init() and init_query_flags() do not do thorough resets
WordPress Trac
wp-trac at lists.automattic.com
Mon Sep 27 17:47:58 UTC 2010
#14976: WP_Query's init() and init_query_flags() do not do thorough resets
--------------------------+-------------------------------------------------
Reporter: coffee2code | Owner:
Type: defect (bug) | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Query | Version: 3.0.1
Severity: minor | Keywords: has-patch
--------------------------+-------------------------------------------------
Despite WP_Query's `init()` documented claim that it "initiates object
properties and sets default values" and that `init_query_flags()` "resets
query flags to false", both are not thorough in their tasks. This likely
stems from these functions not always being kept in sync with changes made
to WP_Query.
For `init()`, the following variables, as defined in the class, are not
reset:
{{{
var $request;
var $post;
var $comments;
var $comment_count = 0;
var $current_comment = -1;
var $comment;
var $found_posts = 0;
var $max_num_pages = 0;
var $max_num_comment_pages = 0;
}}}
For `init_query_flags()`, the following query flags, as defined in the
class, are not reset:
{{{
var $is_preview = false;
var $is_comments_popup = false;
}}}
The attached patch fixes those functions to unset/reset all the above
object variables.
And one additional minor thing: the class variable `$is_paged` was not
explicitly defined as a class variable unlike all the other class
variables, so the patch does so.
--
Ticket URL: <http://core.trac.wordpress.org/ticket/14976>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software
More information about the wp-trac
mailing list