[wp-trac] [WordPress Trac] #47872: Try to create image sub-sizes again when uploading fails with a PHP fatal error

WordPress Trac noreply at wordpress.org
Tue Aug 13 21:23:02 UTC 2019


#47872: Try to create image sub-sizes again when uploading fails with a PHP fatal
error
----------------------------------------------------+---------------------
 Reporter:  azaozz                                  |       Owner:  (none)
     Type:  enhancement                             |      Status:  new
 Priority:  normal                                  |   Milestone:  5.3
Component:  Upload                                  |     Version:
 Severity:  normal                                  |  Resolution:
 Keywords:  has-patch needs-testing needs-dev-note  |     Focuses:
----------------------------------------------------+---------------------
Changes (by azaozz):

 * keywords:   => has-patch needs-testing needs-dev-note


Comment:

 In 47872.diff:
 - When an image upload fails with HTTP 500 error do another AJAX request
 to try to create any missing image sub-sizes. This currently works in the
 Media modal and on the Media Library screen, including support for the old
 inline uploader in Media => Add New. This is attempted three more times.
 - Uses a temporary uploaded file reference (for images only) to retrieve
 the new attachment_id (saved in a transient for 6 hours).

 Currently there are no specific UI changes but the HTTP 500 errors are
 visible in the browser console. If it still fails it shows the error
 messages that come from the server, if any. Then it falls back to the
 default HTTP 500 error (the text was updated to better reflect what's
 going on).

 Testing is very much appreciated, although it's not very straightforward.
 To test best would be to artificially "crash" PHP.
 1. Set `max_execution_time=4` in php.ini to cause a timeout.
 2. Set `memory_limit=64M` in php.ini and add `define(
 'WP_MAX_MEMORY_LIMIT', '64M' );` in wp-config.php to limit the memory.

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


More information about the wp-trac mailing list