Make WordPress Core

Changeset 50552 for trunk


Ignore:
Timestamp:
03/18/2021 11:59:12 PM (4 years ago)
Author:
whyisjake
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:

Fixes #52826.
Props terriann, SergeyBiryukov, Mista-Flo, hellofromTonya, rinatkhaziev, whyisjake.

Location:
trunk/src
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-admin/includes/image.php

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

    r50505 r50552  
    49764976 * @since 5.7.0
    49774977 *
    4978  * @param string $filename  The file path.
    4979  * @param array  $imageinfo Extended image information, passed by reference.
     4978 * @param string $filename   The file path.
     4979 * @param array  $image_info Optional. Extended image information (passed by reference).
    49804980 * @return array|false Array of image information or false on failure.
    49814981 */
    4982 function wp_getimagesize( $filename, &$imageinfo = array() ) {
     4982function wp_getimagesize( $filename, array &$image_info = null ) {
    49834983    if (
    49844984        // Skip when running unit tests.
     
    49884988        defined( 'WP_DEBUG' ) && WP_DEBUG
    49894989    ) {
    4990         return getimagesize( $filename, $imageinfo );
     4990        return getimagesize( $filename, $image_info );
    49914991    }
    49924992
     
    50025002     * phpcs:ignore WordPress.PHP.NoSilencedErrors
    50035003     */
    5004     return @getimagesize( $filename, $imageinfo );
    5005 }
     5004    return @getimagesize( $filename, $image_info );
     5005}
Note: See TracChangeset for help on using the changeset viewer.