Make WordPress Core

Changeset 50553 for branches/5.7


Ignore:
Timestamp:
03/19/2021 02:11:23 AM (4 years ago)
Author:
peterwilsoncc
Message:

Media: Pass the appropriate reference into wp_getimagesize.

With changes that were introduced in #49889 the second parameter for getimagesize() function is expecting a a reference.

Previously, most calls did not pass the 2nd param, and as a result, we are getting unexpected results.

This was only a problem with applications that are using a custom stream wrapper, and the image contained EXIF data.

For more see:

https://github.com/humanmade/S3-Uploads/issues/496
https://github.com/aws/aws-sdk-php/issues/1923

Fixes #52826.
Merges [50552] to the 5.7 branch.
Props terriann, SergeyBiryukov, Mista-Flo, hellofromTonya, rinatkhaziev, whyisjake.

Location:
branches/5.7
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • branches/5.7

  • branches/5.7/src/wp-admin/includes/image.php

    r50170 r50553  
    712712
    713713    $iptc = array();
     714    $info = array();
    714715    /*
    715716     * Read IPTC first, since it might contain data not available in exif such
  • branches/5.7/src/wp-includes/media.php

    r50274 r50553  
    49714971 * @since 5.7.0
    49724972 *
    4973  * @param string $filename  The file path.
    4974  * @param array  $imageinfo Extended image information, passed by reference.
     4973 * @param string $filename   The file path.
     4974 * @param array  $image_info Optional. Extended image information (passed by reference).
    49754975 * @return array|false Array of image information or false on failure.
    49764976 */
    4977 function wp_getimagesize( $filename, &$imageinfo = array() ) {
     4977function wp_getimagesize( $filename, array &$image_info = null ) {
    49784978    if (
    49794979        // Skip when running unit tests.
     
    49834983        defined( 'WP_DEBUG' ) && WP_DEBUG
    49844984    ) {
    4985         return getimagesize( $filename, $imageinfo );
     4985        return getimagesize( $filename, $image_info );
    49864986    }
    49874987
     
    49974997     * phpcs:ignore WordPress.PHP.NoSilencedErrors
    49984998     */
    4999     return @getimagesize( $filename, $imageinfo );
    5000 }
     4999    return @getimagesize( $filename, $image_info );
     5000}
Note: See TracChangeset for help on using the changeset viewer.