Make WordPress Core


Ignore:
Timestamp:
08/25/2008 09:50:11 PM (18 years ago)
Author:
ryan
Message:

Notice fixes. see #7509

File:
1 edited

Legend:

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

    r8702 r8732  
    124124
    125125        $children = get_posts( $r );
    126         if ( !$children )
    127                 return false;
     126        if ( !$children ) {
     127                $kids = false;
     128                return $kids;
     129        }
    128130
    129131        update_post_cache($children);
     
    777779                return $post;
    778780        if ( is_object($post) ) {
     781                if ( !isset($post->ID) )
     782                        $post->ID = 0;
    779783                foreach ( array_keys(get_object_vars($post)) as $field )
    780784                        $post->$field = sanitize_post_field($field, $post->$field, $post->ID, $context);
    781785        } else {
     786                if ( !isset($post['ID']) )
     787                        $post['ID'] = 0;
    782788                foreach ( array_keys($post) as $field )
    783789                        $post[$field] = sanitize_post_field($field, $post[$field], $post['ID'], $context);
     
    13171323
    13181324        // Make sure we set a valid category
    1319         if (0 == count($post_category) || !is_array($post_category)) {
     1325        if ( empty($post_category) || 0 == count($post_category) || !is_array($post_category) ) {
    13201326                $post_category = array(get_option('default_category'));
    13211327        }
     
    13291335        if ( empty($post_type) )
    13301336                $post_type = 'post';
     1337
     1338        $post_ID = 0;
    13311339
    13321340        // Get the post ID and GUID
     
    14331441                }
    14341442        } else {
    1435                 $data['post_mime_type'] = stripslashes( $post_mime_type ); // This isn't in the update
     1443                if ( isset($post_mime_type) )
     1444                        $data['post_mime_type'] = stripslashes( $post_mime_type ); // This isn't in the update
    14361445                if ( false === $wpdb->insert( $wpdb->posts, $data ) ) {
    14371446                        if ( $wp_error )
Note: See TracChangeset for help on using the changeset viewer.