Commit 73b24b0ff0 for wordpress.org
commit 73b24b0ff0e7053211e901bd2166739ffc79e88f
Author: John Blackbourn <johnbillion@git.wordpress.org>
Date: Mon Nov 24 19:10:28 2025 +0000
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
diff --git a/wp-admin/includes/image.php b/wp-admin/includes/image.php
index 1b5f2b1126..2553f68434 100644
--- a/wp-admin/includes/image.php
+++ b/wp-admin/includes/image.php
@@ -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
diff --git a/wp-includes/version.php b/wp-includes/version.php
index e430a91cce..10281f47a1 100644
--- a/wp-includes/version.php
+++ b/wp-includes/version.php
@@ -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.