[wp-trac] [WordPress Trac] #15059: Fix for "Undefined property: WP_Query::$post" in register_globals

WordPress Trac wp-trac at lists.automattic.com
Thu Oct 7 16:22:54 UTC 2010


#15059: Fix for "Undefined property: WP_Query::$post" in register_globals
--------------------------+-------------------------------------------------
 Reporter:  chrisbliss18  |       Owner:                 
     Type:  defect (bug)  |      Status:  new            
 Priority:  normal        |   Milestone:  Awaiting Review
Component:  General       |     Version:  3.1            
 Severity:  normal        |    Keywords:  has-patch      
--------------------------+-------------------------------------------------
 The register_globals function (wp-includes/classes.php) has an unchecked
 property reference. This causes the following warning to be generated on
 post type listings when the post type has no entries:

 {{{
 Notice: Undefined property: WP_Query::$post in ABSPATH/wp-
 includes/classes.php on line 443
 }}}

 The attached patch fixes removes the warning with an isset check that
 assigns a value of null if `$wp_query->post` isn't set. This is the same
 result as assigning the undefined value without the warning.

-- 
Ticket URL: <http://core.trac.wordpress.org/ticket/15059>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list