WordPress.org

Make WordPress Core

Changeset 15405


Ignore:
Timestamp:
07/13/2010 09:30:09 PM (8 years ago)
Author:
ryan
Message:

Sanity check properties in wp_get_single_post(). Props filosofo. fixes #13904 for 3.1

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-includes/post.php

    r15402 r15405  
    20772077
    20782078    $post = get_post($postid, $mode);
     2079
     2080    if (
     2081        ( OBJECT == $mode && empty( $post->ID ) ) ||
     2082        ( OBJECT != $mode && empty( $post['ID'] ) )
     2083    )
     2084        return ( OBJECT == $mode ? null : array() );
    20792085
    20802086    // Set categories and tags
     
    24192425
    24202426    // Drafts shouldn't be assigned a date unless explicitly done so by the user
    2421     if ( in_array($post['post_status'], array('draft', 'pending', 'auto-draft')) && empty($postarr['edit_date']) &&
     2427    if ( isset( $post['post_status'] ) && in_array($post['post_status'], array('draft', 'pending', 'auto-draft')) && empty($postarr['edit_date']) &&
    24222428             ('0000-00-00 00:00:00' == $post['post_date_gmt']) )
    24232429        $clear_date = true;
Note: See TracChangeset for help on using the changeset viewer.