Media: Avoid warning for undefined 'file' key with image meta array in wp_image_add_srcset_and_sizes().

Follow-up to [35412].

Props debarghyabanerjee, sabernhardt, shanemac10, leedxw, MadtownLems, enravo, djsuperfive, westonruter.
See #34430.
Fixes #60480.

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


git-svn-id: http://core.svn.wordpress.org/trunk@60812 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Weston Ruter
2026-01-20 18:10:33 +00:00
parent 4929490d60
commit 513a922ec4
2 changed files with 2 additions and 2 deletions

View File

@@ -1785,7 +1785,7 @@ function wp_image_add_srcset_and_sizes( $image, $image_meta, $attachment_id ) {
}
// Bail early if an image has been inserted and later edited.
if ( preg_match( '/-e[0-9]{13}/', $image_meta['file'], $img_edit_hash )
if ( isset( $image_meta['file'] ) && preg_match( '/-e[0-9]{13}/', $image_meta['file'], $img_edit_hash )
&& ! str_contains( wp_basename( $image_src ), $img_edit_hash[0] )
) {
return $image;

View File

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