Skip to content

Commit 73b24b0

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 Built from https://develop.svn.wordpress.org/trunk@61291 git-svn-id: http://core.svn.wordpress.org/trunk@60603 1a063a9b-81f0-0310-95a4-ce76da25c4cd
1 parent 5973aca commit 73b24b0

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

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

wp-includes/version.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
*
1717
* @global string $wp_version
1818
*/
19-
$wp_version = '7.0-alpha-61290';
19+
$wp_version = '7.0-alpha-61291';
2020

2121
/**
2222
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.

0 commit comments

Comments
 (0)