From 73b24b0ff0e7053211e901bd2166739ffc79e88f Mon Sep 17 00:00:00 2001 From: John Blackbourn Date: Mon, 24 Nov 2025 19:10:28 +0000 Subject: [PATCH] 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 --- wp-admin/includes/image.php | 8 +++++++- wp-includes/version.php | 2 +- 2 files changed, 8 insertions(+), 2 deletions(-) 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.