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

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


git-svn-id: http://core.svn.wordpress.org/trunk@60603 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
John Blackbourn
2025-11-24 19:10:28 +00:00
parent 5973aca182
commit 73b24b0ff0
2 changed files with 8 additions and 2 deletions

View File

@@ -827,7 +827,13 @@ function wp_read_image_metadata( $file ) {
return false;
}
list( , , $image_type ) = wp_getimagesize( $file );
$image_size = wp_getimagesize( $file );
if ( false === $image_size ) {
return false;
}
list( , , $image_type ) = $image_size;
/*
* EXIF contains a bunch of data we'll probably never need formatted in ways

View File

@@ -16,7 +16,7 @@
*
* @global string $wp_version
*/
$wp_version = '7.0-alpha-61290';
$wp_version = '7.0-alpha-61291';
/**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.