From 471fc1e913869015ddcfa9446ef5c8f6c9752974 Mon Sep 17 00:00:00 2001 From: whyisjake Date: Fri, 19 Mar 2021 00:01:03 +0000 Subject: [PATCH] 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 --- wp-admin/includes/image.php | 1 + wp-includes/media.php | 10 +++++----- wp-includes/version.php | 2 +- 3 files changed, 7 insertions(+), 6 deletions(-) diff --git a/wp-admin/includes/image.php b/wp-admin/includes/image.php index 56b9c0a36f..673c1dff01 100644 --- a/wp-admin/includes/image.php +++ b/wp-admin/includes/image.php @@ -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. diff --git a/wp-includes/media.php b/wp-includes/media.php index b0e2c79aef..a5504732d6 100644 --- a/wp-includes/media.php +++ b/wp-includes/media.php @@ -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 ); } diff --git a/wp-includes/version.php b/wp-includes/version.php index f37628d024..182976db86 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -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.