Make WordPress Core

Opened 6 weeks ago

Last modified 3 weeks ago

#62293 reopened defect (bug)

wp_get_missing_image_subsizes() - Warning: Undefined array key "height"

Reported by: apermo's profile apermo Owned by:
Milestone: Priority: normal
Severity: normal Version:
Component: Media Keywords: has-patch
Focuses: Cc:

Description

In certain edge cases it is possible that the keys width or height can be null or not set inside of wp_get_missing_image_subsizes().

I got that warning in the sentry installation of my project. While this was a rare occurrance it did happen.

I propose to add a ternary operator to check and sanitize here like done at other places.

PR on Github.

Change History (10)

This ticket was mentioned in PR #7637 on WordPress/wordpress-develop by @apermo.


6 weeks ago
#1

  • Keywords has-patch added

Added a check if $image_meta['width'] and $image_meta['height'] are set, similar to other places in WordPress Core.

While this is rare case, it popped up in my sentry issues.

Trac ticket: https://core.trac.wordpress.org/ticket/62293

@narenin commented on PR #7637:


6 weeks ago
#2

@apermo This PR looks good to me.

#3 @sabernhardt
6 weeks ago

  • Keywords close added

SVG is one cause for the missing width and height, and #57813 was already opened to address that. Could you change the ticket reference in your pull request (so this ticket can be closed as a duplicate)?

@apermo commented on PR #7637:


6 weeks ago
#4

Changed trac ticket reference as pointed out by @sabernhardt

#5 @apermo
6 weeks ago

  • Resolution set to duplicate
  • Status changed from new to closed

Duplicate of #57813.

#9 @apermo
6 weeks ago

@sabernhardt The more I look into it, the more I am unsure wether these are just related and not a duplicate. I will still try to update my PR to cover that.

I am 100% certain, that in my case it is not an SVG causing the issue.

#10 @desrosj
3 weeks ago

  • Keywords close removed
  • Milestone Awaiting Review deleted
  • Resolution duplicate deleted
  • Status changed from closed to reopened

@apermo I still agree that discussing as part of #57813 is the best course of action at the moment.

Even though the issue was identified with SVGs specifically, that's not how it's described in the ticket description and it would be beneficial to solve it for all formats at once, if possible.

This can always be reopened later if new information presents itself.

Note: See TracTickets for help on using tickets.