Make WordPress Core

Opened 14 years ago

Closed 14 years ago

Last modified 14 years ago

#15059 closed defect (bug) (fixed)

Fix for "Undefined property: WP_Query::$post" in register_globals

Reported by: chrisjean's profile chrisjean Owned by:
Milestone: 3.1 Priority: normal
Severity: normal Version: 3.1
Component: General Keywords: has-patch
Focuses: Cc:


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.

Attachments (1)

fix-undefined-property-post.diff (476 bytes) - added by chrisbliss18 14 years ago.

Download all attachments as: .zip

Change History (3)

#1 @westi
14 years ago

  • Resolution set to fixed
  • Status changed from new to closed

(In [15750]) Avoid Notice if the query doesn't have a post set e.g. on a 404 . Fixes #15059 props chrisbliss18.

#2 @nacin
14 years ago

  • Milestone changed from Awaiting Review to 3.1
Note: See TracTickets for help on using tickets.