Make WordPress Core

Changeset 23869


Ignore:
Timestamp:
03/29/2013 07:10:31 PM (12 years ago)
Author:
SergeyBiryukov
Message:

Make a copy of post content to avoid changing it in get_the_image(). Remove unnecessary assignment from get_the_media(). props wonderboymusic for initial patch. fixes #23888.

File:
1 edited

Legend:

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

    r23847 r23869  
    20702070    }
    20712071
    2072     // these functions expected a reference, not a value
    2073     $_content = $post->post_content;
    2074     $content =& $_content;
     2072    // these functions expect a reference, so we should make a copy of post content to avoid changing it
     2073    $content = $post->post_content;
    20752074
    20762075    $htmls = get_content_media( $type, $content, true, true );
     
    23872386        $count = 1;
    23882387        $matches = array();
    2389         $content =& $post->post_content;
     2388        $content = $post->post_content;
    23902389
    23912390        if ( preg_match_all( '/' . get_shortcode_regex() . '/s', $content, $matches, PREG_SET_ORDER ) && ! empty( $matches ) ) {
     
    24162415    }
    24172416
    2418     $content =& $post->post_content;
     2417    $content = $post->post_content;
    24192418    $htmls = get_content_images( $content, true, true, 1 );
    24202419    if ( ! empty( $htmls ) ) {
Note: See TracChangeset for help on using the changeset viewer.