[wp-trac] [WordPress Trac] #35959: Functon 'wp_generate_attachment_metadata(...)' silently swallowing errors from 'wp_get_image_editor(...)'.

WordPress Trac noreply at wordpress.org
Fri Feb 26 05:11:56 UTC 2016


#35959: Functon 'wp_generate_attachment_metadata(...)' silently swallowing errors
from 'wp_get_image_editor(...)'.
--------------------------+-----------------------------
 Reporter:  maratbn       |      Owner:
     Type:  defect (bug)  |     Status:  new
 Priority:  normal        |  Milestone:  Awaiting Review
Component:  Media         |    Version:  trunk
 Severity:  normal        |   Keywords:
  Focuses:                |
--------------------------+-----------------------------
 So the function {{{wp_generate_attachment_metadata(...)}}} in {{{wp-
 admin/includes/image.php}}} is silently ignoring / swallowing errors from
 the function {{{wp_get_image_editor(...)}}}.

 The logic is here:
 https://core.trac.wordpress.org/browser/trunk/src/wp-
 admin/includes/image.php?rev=36429#L123

 This ignoring of these particular errors prevents user notification in the
 UI when image thumbnails could not be regenerated due to error "{{{No
 editor could be selected}}}" that is returned from the function
 {{{wp_get_image_editor(...)}}} when the PHP environment on the server is
 lacking graphics support.  So the thumbnails are not getting regenerated,
 and because of this bug, there is notification to the user as to that fact
 or as to why.

 I looked this up in the history, and noticed that this bug is present
 since this revision:
 https://core.trac.wordpress.org/changeset/22192

 What's odd is that this revision does add logic to relay these errors in
 its 1st change (to the function {{{wp_crop_image(...)}}}) in {{{trunk/wp-
 admin/includes/image.php}}}, but not in the 3rd change in that file (to
 the function {{{wp_generate_attachment_metadata(...)}}}).  Not sure why
 the error is not being relayed there as well.

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


More information about the wp-trac mailing list