[wp-trac] [WordPress Trac] #48324: Undefined index: full in/wp-includes/media.php on line 214

WordPress Trac noreply at wordpress.org
Wed Oct 16 13:07:46 UTC 2019


#48324: Undefined index: full in/wp-includes/media.php on line 214
--------------------------+-----------------------------
 Reporter:  Mte90         |      Owner:  (none)
     Type:  defect (bug)  |     Status:  new
 Priority:  normal        |  Milestone:  Awaiting Review
Component:  Media         |    Version:
 Severity:  normal        |   Keywords:
  Focuses:                |
--------------------------+-----------------------------
 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.

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/48324>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list