Skip to content

Commit 4de4b72

Browse files
committed
Media: Account for boolean false being returned by wp_getimagesize() when dealing with potentially invalid images in wp_read_image_metadata().
Prior to PHP 8.5 a boolean value was silently ignored when being passed to `list()`, but in PHP 8.5 and higher this now triggers a PHP warning. This change adds an appropriate guard condition. Props swissspidy, adamsilverstein Fixes #64295 git-svn-id: https://develop.svn.wordpress.org/trunk@61291 602fd350-edb4-49c9-b593-d223f7449a82
1 parent f9e9f59 commit 4de4b72

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

src/wp-admin/includes/image.php

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -827,7 +827,13 @@ function wp_read_image_metadata( $file ) {
827827
return false;
828828
}
829829

830-
list( , , $image_type ) = wp_getimagesize( $file );
830+
$image_size = wp_getimagesize( $file );
831+
832+
if ( false === $image_size ) {
833+
return false;
834+
}
835+
836+
list( , , $image_type ) = $image_size;
831837

832838
/*
833839
* EXIF contains a bunch of data we'll probably never need formatted in ways

0 commit comments

Comments
 (0)