[wp-trac] [WordPress Trac] #22061: If $this->posts is empty, don't do stuff to it

WordPress Trac wp-trac at lists.automattic.com
Mon Oct 1 16:42:14 UTC 2012


#22061: If $this->posts is empty, don't do stuff to it
-----------------------------------------+------------------
 Reporter:  wonderboymusic               |       Owner:
     Type:  defect (bug)                 |      Status:  new
 Priority:  normal                       |   Milestone:  3.5
Component:  Query                        |     Version:  2.9
 Severity:  normal                       |  Resolution:
 Keywords:  has-patch reporter-feedback  |
-----------------------------------------+------------------
Changes (by nacin):

 * keywords:  has-patch => has-patch reporter-feedback


Comment:

 Normally, if you try to nuke the main query by getting null to be passed
 to $wpdb->get_results(), then you also need to hook into posts_results to
 properly set $this->posts again. posts_results happens just after [22011].
 This is how the advance post caching plugin works.

 So, on one hand, we should set $this->posts to an empty array, if by some
 point it is not an array. On the other hand, if it isn't an array by that
 point, then a developer error occurred, and it probably should continue to
 blare warnings until it is fixed.

 I'd try to track down why it posts is actually not an array by the time we
 start treating it like one.

-- 
Ticket URL: <http://core.trac.wordpress.org/ticket/22061#comment:7>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list