WordPress.org

Make WordPress Core

Ticket #7871: 7871.r9124.diff

File 7871.r9124.diff, 4.8 KB (added by jacobsantos, 6 years ago)

Fix for malformed array in database based off of r9124

  • wp-admin/includes/media.php

     
    680680        return wp_iframe( 'media_upload_library_form', $errors ); 
    681681} 
    682682 
    683 // produce HTML for the image alignment radio buttons with the specified one checked 
    684683/** 
    685  * {@internal Missing Short Description}} 
     684 * Retrieve HTML for the image alignment radio buttons with the specified one checked. 
    686685 * 
    687686 * @since unknown 
    688687 * 
     
    706705        return join("\n", $out); 
    707706} 
    708707 
    709 // produce HTML for the size radio buttons with the specified one checked 
    710708/** 
    711  * {@internal Missing Short Description}} 
     709 * Retrieve HTML for the size radio buttons with the specified one checked. 
    712710 * 
    713711 * @since unknown 
    714712 * 
     
    723721                 
    724722                foreach ( $size_names as $size => $name) { 
    725723                        $downsize = image_downsize($post->ID, $size); 
    726                          
     724 
    727725                        // is this size selectable? 
    728726                        $enabled = ( $downsize[3] || 'full' == $size ); 
    729727                        $css_id = "image-size-{$size}-{$post->ID}"; 
     
    753751                ); 
    754752} 
    755753 
    756 // produce HTML for the Link URL buttons with the default link type as specified 
    757754/** 
    758  * {@internal Missing Short Description}} 
     755 * Retrieve HTML for the Link URL buttons with the default link type as specified. 
    759756 * 
    760757 * @since unknown 
    761758 * 
     
    960957} 
    961958 
    962959/** 
    963  * {@internal Missing Short Description}} 
     960 * Retrieve HTML for media items of post gallery. 
    964961 * 
     962 * The HTML markup retrieved will be created for the progress of SWF Upload 
     963 * component. Will also create link for showing and hiding the form to modify 
     964 * the image attachment. 
     965 * 
    965966 * @since unknown 
    966967 * 
    967  * @param unknown_type $post_id 
    968  * @param unknown_type $errors 
    969  * @return unknown 
     968 * @param int $post_id Optional. Post ID. 
     969 * @param array $errors Errors for attachment, if any. 
     970 * @return string 
    970971 */ 
    971972function get_media_items( $post_id, $errors ) { 
    972973        if ( $post_id ) { 
     
    992993} 
    993994 
    994995/** 
    995  * {@internal Missing Short Description}} 
     996 * Retrieve HTML form for modifying the image attachment. 
    996997 * 
    997998 * @since unknown 
    998999 * 
    999  * @param unknown_type $attachment_id 
    1000  * @param unknown_type $args 
    1001  * @return unknown 
     1000 * @param int $attachment_id Attachment ID for modification. 
     1001 * @param string|array $args Optional. Override defaults. 
     1002 * @return string HTML form for attachment. 
    10021003 */ 
    10031004function get_media_item( $attachment_id, $args = null ) { 
    10041005        global $redir_tab; 
     
    18031804'; 
    18041805} 
    18051806 
    1806 // support a GET parameter for disabling the flash uploader 
    18071807/** 
    18081808 * {@internal Missing Short Description}} 
    18091809 * 
     1810 * Support a GET parameter for disabling the flash uploader. 
     1811 * 
    18101812 * @since unknown 
    18111813 * 
    18121814 * @param unknown_type $flash 
     
    18531855add_action('post-flash-upload-ui', 'media_upload_flash_bypass'); 
    18541856add_action('post-html-upload-ui', 'media_upload_html_bypass'); 
    18551857 
    1856 // make sure the GET parameter sticks when we submit a form 
    18571858/** 
    18581859 * {@internal Missing Short Description}} 
    18591860 * 
     1861 * Make sure the GET parameter sticks when we submit a form. 
     1862 * 
    18601863 * @since unknown 
    18611864 * 
    18621865 * @param unknown_type $url 
  • wp-includes/post.php

     
    519519 
    520520        // expected_slashed ($meta_key) 
    521521        $meta_key = stripslashes($meta_key); 
    522         $meta_value = stripslashes($meta_value); 
     522        if( is_string($meta_value) ) 
     523                $meta_value = stripslashes($meta_value); 
     524        else 
     525                $meta_value = maybe_serialize($meta_value); 
    523526 
    524527        if ( $unique && $wpdb->get_var( $wpdb->prepare( "SELECT meta_key FROM $wpdb->postmeta WHERE meta_key = %s AND post_id = %d", $meta_key, $post_id ) ) ) 
    525528                return false; 
    526529 
    527         $meta_value = maybe_serialize($meta_value); 
    528  
    529530        $wpdb->insert( $wpdb->postmeta, compact( 'post_id', 'meta_key', 'meta_value' ) ); 
    530531 
    531532        wp_cache_delete($post_id, 'post_meta'); 
     
    556557 
    557558        // expected_slashed ($key, $value) 
    558559        $key = stripslashes( $key ); 
    559         $value = stripslashes( $value ); 
     560        if( is_string($meta_value) ) 
     561                $meta_value = stripslashes($meta_value); 
     562        else 
     563                $meta_value = maybe_serialize($meta_value); 
    560564 
    561565        if ( empty( $value ) ) 
    562566                $meta_id = $wpdb->get_var( $wpdb->prepare( "SELECT meta_id FROM $wpdb->postmeta WHERE post_id = %d AND meta_key = %s", $post_id, $key ) ); 
     
    632636 
    633637        // expected_slashed ($meta_key) 
    634638        $meta_key = stripslashes($meta_key); 
    635         $meta_value = stripslashes($meta_value); 
    636639 
     640        if( is_string($meta_value) ) 
     641                $meta_value = stripslashes($meta_value); 
     642        else 
     643                $meta_value = maybe_serialize($meta_value); 
     644 
    637645        if ( ! $wpdb->get_var( $wpdb->prepare( "SELECT meta_key FROM $wpdb->postmeta WHERE meta_key = %s AND post_id = %d", $meta_key, $post_id ) ) ) { 
    638646                return add_post_meta($post_id, $meta_key, $meta_value); 
    639647        } 
    640648 
    641         $meta_value = maybe_serialize($meta_value); 
    642  
    643649        $data  = compact( 'meta_value' ); 
    644650        $where = compact( 'meta_key', 'post_id' ); 
    645651