[wp-trac] [WordPress Trac] #48200: Fix the method used to create image sub-sizes when uploading fails with a PHP fatal error

WordPress Trac noreply at wordpress.org
Sat Oct 5 15:46:59 UTC 2019


#48200: Fix the method used to create image sub-sizes when uploading fails with a
PHP fatal error
--------------------------+-----------------------
 Reporter:  azaozz        |       Owner:  azaozz
     Type:  defect (bug)  |      Status:  reopened
 Priority:  high          |   Milestone:  5.3
Component:  Upload        |     Version:  trunk
 Severity:  normal        |  Resolution:
 Keywords:                |     Focuses:
--------------------------+-----------------------

Comment (by azaozz):

 Replying to [comment:3 TimothyBlynJacobs]:
 > I don't think this is strictly necessary, but for consideration, I
 uploaded a patch that only sends the header in the API endpoints instead
 of the lower level sub-sizing functions.

 This will change the way (prevent) how this is used outside the API. With
 48200.2.diff it won't be able to retry to make sub-sizes when using
 `wp_create_image_subsizes()` or wp_update_image_subsizes()` directly.

 I'm actually thinking the opposite :) The API shouldn't be concerned about
 this header at all, It is part of "site health" fatal error protection.
 Also thinking it may make sense to always set it for all uploads, so
 plugins have a chance to "do something" or at least show better error
 messages when any upload fails.

 When there is no fatal error and we don't want to send it, it can be
 "unset" just before the "success" response. But I don't see why that would
 be needed.

 > This would also allow us to make the REST API version a bit more
 behaved. Where ideally the header would only be sent for the main REST API
 request, not internal API requests.

 Hmm, what would be "internal" requests here and why would they be worse
 off with this header? The presence of this header is strictly for use by
 the client in case of a PHP fatal error, while using the API or not.

 If it is a concern that it may be set several times, we can probably add a
 small helper function for it. Calling `header()` multiple times overrides
 the value, but may also add another header.

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


More information about the wp-trac mailing list