[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 6 02:31:53 UTC 2019


#47987: REST API: Add handling of PHP fatal errors while resizing images after
upload
--------------------------+---------------------
 Reporter:  azaozz        |       Owner:  (none)
     Type:  defect (bug)  |      Status:  new
 Priority:  high          |   Milestone:  5.3
Component:  REST API      |     Version:
 Severity:  normal        |  Resolution:
 Keywords:                |     Focuses:
--------------------------+---------------------

Comment (by azaozz):

 Generally when uploading an image the client should be able to send an
 unique "upload reference" which is then stored in a transient for one
 hour, and deleted if all image sub-sizes were created successfully. See
 https://core.trac.wordpress.org/browser/trunk/src/wp-
 admin/includes/media.php?rev=45934#L379 and
 https://core.trac.wordpress.org/browser/trunk/src/wp-
 admin/includes/media.php?rev=45934#L417.

 Then if the response is HTTP 500, the client should be able to do another
 request including the upload reference from above, and the server should
 try to make any missing image sub-sizes. The upload reference is used to
 find the new attachment ID as the client doesn't know it yet. On the
 server side that would work similarly to:
 https://core.trac.wordpress.org/browser/trunk/src/wp-admin/includes/ajax-
 actions.php?rev=45934#L2416.

 Then, if all attempts fail, the client should be able to do a "cleanup":
 delete the just created attachment. Again, the upload reference is used to
 find the attachment ID.

 And lastly, the error message shown should be... More helpful than the
 default "This site is experiencing difficulties...". That could be on the
 client side though.

 This is now implemented in #47872 for the media library and the media
 popup. Any suggestions for improvements welcome :)

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


More information about the wp-trac mailing list