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

WordPress Trac noreply at wordpress.org
Fri Sep 27 16:19:07 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:  needs-patch      |     Focuses:
-----------------------------+--------------------------------

Comment (by azaozz):

 > ...a key wouldn't necessarily be considered a reference to the media,
 but a reference to the specific HTTP request that needs to be
 retried/resumed.

 Right. The key/upload_ref is specific for the upload request. It is needed
 so the server can find the just created attachment_ID and resume post-
 processing of the uploaded file. If the upload has failed before an
 attachment post was created, it just returns an error.

 > ...the create_item() endpoint tries to handle post-processing on the
 first attempt, but fails, then it should try again on the second attempt
 in an idempotent model.

 Sure. Post-processing is started automatically by the server after the
 uploading of the file is done. If it fails, and the client gets an HTTP
 500 response, the client should do another request to continue the post-
 processing.

 > how would the client handle incomplete requests if it's interrupted
 (i.e. the user reloads the page after an upload)?

 This is/should be handled by the UI as "uploading is in progress". The
 upload is not complete until all requests for post-processing are done. If
 the user reloads the page or navigates away while the upload is in
 progress, it will fail.

 If the post-processing fails after all attempts, the final request is to
 do a "clenaup" (delete the new attachment). Then the UI should show an
 appropriate error message. In this case it should advise the client to
 scale down the image and upload it again, see
 https://core.trac.wordpress.org/browser/trunk/src/wp-includes/script-
 loader.php?rev=46289#L1237.

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


More information about the wp-trac mailing list