[wp-trac] [WordPress Trac] #47987: REST API: Add handling of PHP fatal errors while resizing images after upload
WordPress Trac
noreply at wordpress.org
Wed Oct 2 18:58:30 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 |
-------------------------------------------------+-------------------------
Comment (by azaozz):
Replying to [comment:29 TimothyBlynJacobs]:
> We aren't handling when the set transient fails though.
Right. This is not handled well currently. If it fails, it won't be able
to retry to create the sub-sizes, i.e. reverts back to the current
behaviour.
> If the transient wasn't saved, and an upload error occurred, they
wouldn't be able to clean up the failed upload, no?
Yes, it will show as a partial/failed upload in the media library, same as
before.
The only way we can "act" on that error is to disregard the uploaded file
(as the upload has already completed) and return an error telling the user
(the client) to try uploading again. For the user/client the error would
still be the same "please try again" regardless of the cause. It will also
need to delete the just created attachment post as the upload will be
considered to have failed.
However that means disregarding the uploaded file and deleting the
attachment in all cases, even when it would not fail the post-processing.
As retrying is needed quite rarely, that seems like a high price to pay?
Another option that I looked at was to return the new attachment_id
instead of the "Your site is experiencing problems" error message. However
was unable to confirm it would work in all cases, so opted to store the
transient. Perhaps can revisit this again, not too late yet. Will look at
this now :)
--
Ticket URL: <https://core.trac.wordpress.org/ticket/47987#comment:30>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list