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.

Built from https://develop.svn.wordpress.org/branches/5.7@50553


git-svn-id: http://core.svn.wordpress.org/branches/5.7@50166 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Peter Wilson 2021-03-19 02:13:05 +00:00
parent b1855cb9d0
commit 37d01e0346
3 changed files with 7 additions and 6 deletions

View File

@ -711,6 +711,7 @@ function wp_read_image_metadata( $file ) {
); );
$iptc = array(); $iptc = array();
$info = array();
/* /*
* Read IPTC first, since it might contain data not available in exif such * Read IPTC first, since it might contain data not available in exif such
* as caption, description etc. * as caption, description etc.

View File

@ -4971,10 +4971,10 @@ function wp_show_heic_upload_error( $plupload_settings ) {
* @since 5.7.0 * @since 5.7.0
* *
* @param string $filename The file path. * @param string $filename The file path.
* @param array $imageinfo Extended image information, passed by reference. * @param array $image_info Optional. Extended image information (passed by reference).
* @return array|false Array of image information or false on failure. * @return array|false Array of image information or false on failure.
*/ */
function wp_getimagesize( $filename, &$imageinfo = array() ) { function wp_getimagesize( $filename, array &$image_info = null ) {
if ( if (
// Skip when running unit tests. // Skip when running unit tests.
! defined( 'WP_RUN_CORE_TESTS' ) ! defined( 'WP_RUN_CORE_TESTS' )
@ -4982,7 +4982,7 @@ function wp_getimagesize( $filename, &$imageinfo = array() ) {
// Return without silencing errors when in debug mode. // Return without silencing errors when in debug mode.
defined( 'WP_DEBUG' ) && WP_DEBUG defined( 'WP_DEBUG' ) && WP_DEBUG
) { ) {
return getimagesize( $filename, $imageinfo ); return getimagesize( $filename, $image_info );
} }
/* /*
@ -4996,5 +4996,5 @@ function wp_getimagesize( $filename, &$imageinfo = array() ) {
* *
* phpcs:ignore WordPress.PHP.NoSilencedErrors * phpcs:ignore WordPress.PHP.NoSilencedErrors
*/ */
return @getimagesize( $filename, $imageinfo ); return @getimagesize( $filename, $image_info );
} }

View File

@ -13,7 +13,7 @@
* *
* @global string $wp_version * @global string $wp_version
*/ */
$wp_version = '5.7.1-alpha-50539'; $wp_version = '5.7.1-alpha-50553';
/** /**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema. * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.