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
This commit is contained in:
ryan 2010-07-13 21:30:33 +00:00
parent 6bd16888b1
commit 563b901f42
1 changed files with 7 additions and 1 deletions

View File

@ -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