From 563b901f42c6c0616317d30e6e07940c1ffde526 Mon Sep 17 00:00:00 2001 From: ryan Date: Tue, 13 Jul 2010 21:30:33 +0000 Subject: [PATCH] Sanity check properties in wp_get_single_post(). Props filosofo. fixes #13904 for 3.0.1 git-svn-id: http://svn.automattic.com/wordpress/branches/3.0@15406 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-includes/post.php | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/wp-includes/post.php b/wp-includes/post.php index 00d7ac6f5c..d5fb94dd9d 100644 --- a/wp-includes/post.php +++ b/wp-includes/post.php @@ -2077,6 +2077,12 @@ function wp_get_single_post($postid = 0, $mode = OBJECT) { $post = get_post($postid, $mode); + if ( + ( OBJECT == $mode && empty( $post->ID ) ) || + ( OBJECT != $mode && empty( $post['ID'] ) ) + ) + return ( OBJECT == $mode ? null : array() ); + // Set categories and tags if ( $mode == OBJECT ) { $post->post_category = array(); @@ -2418,7 +2424,7 @@ function wp_update_post($postarr = array()) { $post_cats = $post['post_category']; // Drafts shouldn't be assigned a date unless explicitly done so by the user - if ( in_array($post['post_status'], array('draft', 'pending', 'auto-draft')) && empty($postarr['edit_date']) && + if ( isset( $post['post_status'] ) && in_array($post['post_status'], array('draft', 'pending', 'auto-draft')) && empty($postarr['edit_date']) && ('0000-00-00 00:00:00' == $post['post_date_gmt']) ) $clear_date = true; else