[wp-trac] [WordPress Trac] #48451: Regression: wp_update_attachment_metadata filter now fires very often and without complete metadata

WordPress Trac noreply at wordpress.org
Sun Nov 3 20:07:22 UTC 2019


#48451: Regression: wp_update_attachment_metadata filter now fires very often and
without complete metadata
-------------------------------------------+---------------------
 Reporter:  ianmjones                      |       Owner:  (none)
     Type:  defect (bug)                   |      Status:  new
 Priority:  normal                         |   Milestone:  5.3
Component:  Media                          |     Version:  trunk
 Severity:  normal                         |  Resolution:
 Keywords:  has-patch needs-testing close  |     Focuses:
-------------------------------------------+---------------------
Changes (by johnbillion):

 * keywords:  2nd-opinion has-patch needs-testing => has-patch needs-testing
     close


Comment:

 Chatted with Joe about this ^ at WCUS and we're in agreement that it's
 unsafe for an extension to assume that the image sizes array passed to
 this filter is complete, especially as it's called in different places in
 core for many reasons.

 In addition to the points above, the change in the patch has potential to
 result in a situation where image size meta data has partially been
 generated and stored, but the final call to
 `wp_update_attachment_metadata()` never gets called due to memory
 allocation issue, which would result in an attachment with metadata that's
 made available but has never made its way through the
 `wp_update_attachment_metadata` filter. This is also the case in the
 interim while image sizes are being generated.

 If an extension uses the `wp_update_attachment_metadata` filter to offload
 media elsewhere, it should keep track of which files of which sizes have
 been offloaded to avoid duplicate processing, regardless of the
 incremental image size generation changes that have gone into 5.3.

 Recommending for close.

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/48451#comment:9>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list