Make WordPress Core

Ticket #18310: 18310-2.diff

File 18310-2.diff, 1.2 KB (added by ericmann, 11 years ago)

Patch refresh, and also check that $file->guid is actually set before using it.

  • wp-includes/class-wp-xmlrpc-server.php

     
    39533953                $attachments = $wpdb->get_results( "SELECT ID, guid FROM {$wpdb->posts} WHERE post_parent = '0' AND post_type = 'attachment'" );
    39543954                if ( is_array( $attachments ) ) {
    39553955                        foreach ( $attachments as $file ) {
    3956                                 if ( strpos( $post_content, $file->guid ) !== false )
     3956                                if ( isset( $file->guid ) && strpos( $post_content, $file->guid ) !== false )
    39573957                                        $wpdb->update($wpdb->posts, array('post_parent' => $post_ID), array('ID' => $file->ID) );
    39583958                        }
    39593959                }
  • wp-includes/post.php

     
    37843784                $wpdb->update( $wpdb->posts, compact("post_name"), array( 'ID' => $post_ID ) );
    37853785        }
    37863786
     3787        // Set GUID
     3788        if ( ! isset( $guid ) )
     3789                $wpdb->update ( $wpdb->posts, arrray( 'guid' => get_permalink( $post_ID ) ), array( 'ID' => $post_ID ) );
     3790
    37873791        wp_set_post_categories($post_ID, $post_category);
    37883792
    37893793        if ( $file )