WordPress.org

Make WordPress Core

Ticket #19865: do_enclose-19735.diff

File do_enclose-19735.diff, 838 bytes (added by jeremyclarke, 4 years ago)

fix do_enclose throwing errors while checking for media to enclose

  • wp-includes/functions.php

     
    521521                if ( $url != '' && !$wpdb->get_var( $wpdb->prepare( "SELECT post_id FROM $wpdb->postmeta WHERE post_id = %d AND meta_key = 'enclosure' AND meta_value LIKE (%s)", $post_ID, like_escape( $url ) . '%' ) ) ) { 
    522522 
    523523                        if ( $headers = wp_get_http_headers( $url) ) { 
    524                                 $len = (int) $headers['content-length']; 
    525                                 $type = $headers['content-type']; 
     524                                $len = isset( $headers['content-length'] )? (int) $headers['content-length'] : 0; 
     525                                $type = isset( $headers['content-type'] )? $headers['content-type'] : ''; 
    526526                                $allowed_types = array( 'video', 'audio' ); 
    527527 
    528528                                // Check to see if we can figure out the mime type from