Media: Avoid suppressing errors when using getimagesize().

Previously, all logic utilizing `getimagesize()` was supressing errors making it difficult to debug usage of the function. 

A new `wp_getimagesize()` function has been added to allow the errors to no longer be suppressed when `WP_DEBUG` is enabled.

Props Howdy_McGee, SergeyBiryukov, mukesh27, davidbaumwald, noisysocks, hellofromTonya.
Fixes #49889.

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


git-svn-id: http://core.svn.wordpress.org/trunk@49825 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
antpb
2021-02-02 16:53:04 +00:00
parent ce816eeda1
commit f80e5d0919
9 changed files with 73 additions and 18 deletions

View File

@@ -105,7 +105,7 @@ class WP_Image_Editor_GD extends WP_Image_Editor {
return new WP_Error( 'invalid_image', __( 'File is not an image.' ), $this->file );
}
$size = @getimagesize( $this->file );
$size = wp_getimagesize( $this->file );
if ( ! $size ) {
return new WP_Error( 'invalid_image', __( 'Could not read image size.' ), $this->file );