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 | 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
#3
@
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)?
6 weeks ago
#8
Trac ticket: https://core.trac.wordpress.org/ticket/57813
#9
@
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
@
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.
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