[wp-trac] [WordPress Trac] #47987: REST API: Add handling of PHP fatal errors while resizing images after upload

WordPress Trac noreply at wordpress.org
Sat Oct 5 16:04:05 UTC 2019


#47987: REST API: Add handling of PHP fatal errors while resizing images after
upload
-------------------------------------------------+-------------------------
 Reporter:  azaozz                               |       Owner:
                                                 |  TimothyBlynJacobs
     Type:  task (blessed)                       |      Status:  accepted
 Priority:  highest omg bbq                      |   Milestone:  5.3
Component:  REST API                             |     Version:
 Severity:  normal                               |  Resolution:
 Keywords:  has-patch needs-unit-tests dev-      |     Focuses:
  feedback commit                                |
-------------------------------------------------+-------------------------
Changes (by azaozz):

 * keywords:  has-patch needs-unit-tests dev-feedback => has-patch needs-
     unit-tests dev-feedback commit


Comment:

 47987.5.diff looks very good! :)

 The only thing I'm a bit unsure about is including the header only on the
 first upload request. This bit:

 {{{
 if ( defined( 'REST_REQUEST' ) && REST_REQUEST ) {
    // Set a custom header with the attachment_id.
    // Used by the browser/client to resume creating image sub-sizes after
 a PHP fatal error.
    header( 'X-WP-Upload-Attachment-ID: ' . $attachment_id );
 }
 }}}

 Thinking that the API shouldn't be concerned about this header at all. It
 is rather a part of "site health PHP fatal error protection" and would
 allow the client to "do something" when a fatal error happens while
 uploading a file. The API just provides the methods/end points to make
 this possible. Ultimately the client should decide what needs to be done
 when there are PHP fatal errors/HTTP 500 responses :)

 Think this is ready for committing, perhaps without that `header()` call.

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


More information about the wp-trac mailing list