Make WordPress Core

Opened 12 months ago

Last modified 12 months ago

#58535 new defect (bug)

Undefined array key "file" in function wp_calculate_image_srcset()

Reported by: martinjhenne's profile martinjhenne Owned by:
Milestone: Future Release Priority: normal
Severity: normal Version:
Component: General Keywords:
Focuses: Cc:

Description

I noticed the following two warnings in the error log:

PHP Warning:  Undefined array key "file" in xxx/wp-includes/media.php on line 1367"
PHP Warning:  Undefined array key "file" in xxx/wp-includes/media.php on line 1373"

Change History (3)

#1 @martinjhenne
12 months ago

More warnings in the same function

PHP Warning:  Undefined array key "width" in xxx/wp-includes/media.php on line 1390
PHP Warning:  Undefined array key "height" in xxx/wp-includes/media.php on line 1390

#2 follow-up: @joemcgill
12 months ago

  • Milestone changed from Awaiting Review to Future Release
  • Version 6.2.2 deleted

Hi @martinjhenne,

Thanks for reporting this. It seems like something is causing the metadata associated with your intermediate image sizes (the extra crops that WordPress creates when you upload an image) to be formatted incorrectly. We can probably add some extra safety checks in place to this function in order to avoid these types of warnings, but I would encourage you to find out what is causing this. It could be either a plugin that you are using that modifies the image data before it's saved to the database, or a plugin that is filtering the metadata for image sizes before it reaches this function.

#3 in reply to: ↑ 2 @martinjhenne
12 months ago

Replying to joemcgill:

Hi @martinjhenne,

Thanks for reporting this. It seems like something is causing the metadata associated with your intermediate image sizes (the extra crops that WordPress creates when you upload an image) to be formatted incorrectly. We can probably add some extra safety checks in place to this function in order to avoid these types of warnings, but I would encourage you to find out what is causing this. It could be either a plugin that you are using that modifies the image data before it's saved to the database, or a plugin that is filtering the metadata for image sizes before it reaches this function.

I use svg and webp images. Can this be a reason?

Note: See TracTickets for help on using tickets.