#48324 closed defect (bug) (fixed)
Undefined index: full in/wp-includes/media.php on line 214
Reported by: |
|
Owned by: |
|
---|---|---|---|
Milestone: | 5.3.1 | Priority: | normal |
Severity: | normal | Version: | 4.7 |
Component: | Media | Keywords: | has-patch 2nd-opinion needs-testing |
Focuses: | Cc: |
Description
I don't know why I am getting this error but is very spammy on the log.
After a look inside the code I found the guilty line https://github.com/WordPress/WordPress/blob/5.2-branch/wp-includes/media.php#L211
if ( ! $is_image ) { if ( ! empty( $meta['sizes'] ) ) { $img_url = str_replace( $img_url_basename, $meta['sizes']['full']['file'], $img_url ); [...]
The fix is quite simple:
if ( ! $is_image ) { if ( ! empty( $meta['sizes'] ) && isset( $meta['sizes']['full'] ) ) { $img_url = str_replace( $img_url_basename, $meta['sizes']['full']['file'], $img_url ); [...]
From the code seems that doesn't found an attachment size, maybe because I am using the new live_url
feature of VVV (https://github.com/Varying-Vagrant-Vagrants/custom-site-template) that let o redirect by nginx the image using a remote, so is not required to have a copy of the files.
Attachments (2)
Change History (9)
This ticket was mentioned in Slack in #core-media by mike. View the logs.
5 years ago
#4
@
5 years ago
Had a quick look. IMHO a simpler fix - and just as effective - would be to replace the ! empty( $meta['sizes'] )
with ! empty( $meta['sizes']['full'] )
.
Side-note: I do wonder how an image can exist without a full sized version ? Sratch that, just noticed this only applies to non-images.
fix as proposed in the ticket