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.
Props terriann, SergeyBiryukov, Mista-Flo, hellofromTonya, rinatkhaziev, whyisjake.


Built from https://develop.svn.wordpress.org/trunk@50552


git-svn-id: http://core.svn.wordpress.org/trunk@50165 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
whyisjake 2021-03-19 00:01:03 +00:00
parent 3363e22f80
commit 471fc1e913
3 changed files with 7 additions and 6 deletions

View File

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

View File

@ -4975,11 +4975,11 @@ function wp_show_heic_upload_error( $plupload_settings ) {
*
* @since 5.7.0
*
* @param string $filename The file path.
* @param array $imageinfo Extended image information, passed by reference.
* @param string $filename The file path.
* @param array $image_info Optional. Extended image information (passed by reference).
* @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 (
// Skip when running unit tests.
! defined( 'WP_RUN_CORE_TESTS' )
@ -4987,7 +4987,7 @@ function wp_getimagesize( $filename, &$imageinfo = array() ) {
// Return without silencing errors when in debug mode.
defined( 'WP_DEBUG' ) && WP_DEBUG
) {
return getimagesize( $filename, $imageinfo );
return getimagesize( $filename, $image_info );
}
/*
@ -5001,5 +5001,5 @@ function wp_getimagesize( $filename, &$imageinfo = array() ) {
*
* phpcs:ignore WordPress.PHP.NoSilencedErrors
*/
return @getimagesize( $filename, $imageinfo );
return @getimagesize( $filename, $image_info );
}

View File

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