Make WordPress Core


Ignore:
Timestamp:
02/22/2008 05:43:56 PM (19 years ago)
Author:
ryan
Message:

Notice fixes from nbachiyski. fixes #5961

File:
1 edited

Legend:

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

    r6974 r6983  
    181181                return $_post;
    182182        } elseif ( $output == ARRAY_A ) {
    183                 return get_object_vars($_post);
     183                $__post = get_object_vars($_post);
     184                return $__post;
    184185        } elseif ( $output == ARRAY_N ) {
    185                 return array_values(get_object_vars($_post));
     186                $__post = array_values(get_object_vars($_post));
     187                return $__post;
    186188        } else {
    187189                return $_post;
    … …  
    699701        if ( 'raw' == $context )
    700702                return $post;
    701 
    702         if ( is_object($post) )
     703        if ( is_object($post) ) {
     704                if ( !isset($post->ID) )
     705                        return $post;
    703706                foreach ( array_keys(get_object_vars($post)) as $field )
    704707                        $post->$field = sanitize_post_field($field, $post->$field, $post->ID, $context);
    705         else
     708        } else {
     709                if ( !isset($post['ID']) )
     710                        return $post;
    706711                foreach ( array_keys($post) as $field )
    707712                        $post[$field] = sanitize_post_field($field, $post[$field], $post['ID'], $context);
    708 
     713        }
    709714        return $post;
    710715}
    … …  
    23672372 */
    23682373function wp_check_for_changed_slugs($post_id) {
    2369         if ( !strlen($_POST['wp-old-slug']) )
     2374        if ( !isset($_POST['wp-old-slug']) || !strlen($_POST['wp-old-slug']) )
    23702375                return $post_id;
    23712376
Note: See TracChangeset for help on using the changeset viewer.