[wp-trac] [WordPress Trac] #52030: Media metaboxes return fatal error if no author metadata present

WordPress Trac noreply at wordpress.org
Fri Dec 11 11:13:41 UTC 2020


#52030: Media metaboxes return fatal error if no author metadata present
---------------------------------+-----------------------------
 Reporter:  carloscastilloadhoc  |      Owner:  (none)
     Type:  defect (bug)         |     Status:  new
 Priority:  normal               |  Milestone:  Awaiting Review
Component:  Media                |    Version:  5.6
 Severity:  normal               |   Keywords:
  Focuses:                       |
---------------------------------+-----------------------------
 Images uploaded programatically to the media library via the
 wp_insert_attachment function won't have author metadata. This causes a
 fatal error in the metaboxes when you try to use the "edit media" option
 in the media library.

 Specifically: Uncaught Error: Call to a member function exists() on bool
 in wp-admin/includes/media.php line 3295

 This can be fixed for example by expanding the condition
 "if($author->exists())" with "if($author && $author->exists())".

 While I haven't personally encountered them, this may cause additional
 errors in other places where the same check is performed (for example the
 wp_prepare_attachment_for_js function in wp-includes/media.php).

 Thank you and kind regards.

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


More information about the wp-trac mailing list