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.



git-svn-id: https://develop.svn.wordpress.org/trunk@50552 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Jake Spurlock 2021-03-18 23:59:12 +00:00
parent a6d69a3298
commit 140bd894d6
2 changed files with 6 additions and 5 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 );
}