WordPress.org

Make WordPress Core

Changeset 39654


Ignore:
Timestamp:
12/30/2016 06:23:56 AM (17 months ago)
Author:
dd32
Message:

Media: Move a variable definition outside of conditionals to ensure it's always available.
This fixes cases where the URL to a PDF preview may be incorrectly calculated when no thumbnails were generated for the PDF (and avoids a PHP Notice at the same time).

Merges [39612] to the 4.7 branch.
Fixes #39250.

Location:
branches/4.7
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/4.7

  • branches/4.7/src/wp-includes/media.php

    r39399 r39654  
    30643064
    30653065    $attachment_url = wp_get_attachment_url( $attachment->ID );
     3066    $base_url = str_replace( wp_basename( $attachment_url ), '', $attachment_url );
    30663067
    30673068    $response = array(
     
    31713172                );
    31723173            } elseif ( isset( $meta['sizes'][ $size ] ) ) {
    3173                 if ( ! isset( $base_url ) )
    3174                     $base_url = str_replace( wp_basename( $attachment_url ), '', $attachment_url );
    3175 
    31763174                // Nothing from the filter, so consult image metadata if we have it.
    31773175                $size_meta = $meta['sizes'][ $size ];
Note: See TracChangeset for help on using the changeset viewer.