#10238 closed defect (bug) (fixed)
A failed upload loses its error messages
| Reported by: |
|
Owned by: |
|
|---|---|---|---|
| Priority: | high | Milestone: | 2.8.1 |
| Component: | Media | Version: | 2.8 |
| Severity: | major | Keywords: | media_upload_form_handler has-patch upload |
| Cc: |
Description
If there are errors in some uploads, WP fails to report it because the errors are erased. That happens because the $errors variable is initialized at the top of media_upload_form_handler() to an empty array (new behavior in 2.8), but lines like 490 of wp-admin/includes/media.php set $errors to the (sometimes empty) $return variable returned by media_upload_form_handler() when that $return variable is an array.
Prior to 2.8, the behavior was that media_upload_form_handler() would return NULL, so $errors would remain. Now, media_upload_form_handler() returns an empty array, and $errors is set to that empty array.
Patch initializes $errors in media_upload_form_handler() to NULL.
I think this is related to #10153 among others.
Attachments (1)
Change History (9)
Tested patch with browser and flash uploaders from both the edit post page and the new media page.
Tested the failure case where the server goes away. With and without the patch produced an I/O error notice. Did you simulate any error conditions?
Replying to ryan:
Did you simulate any error conditions?
Yes, two:
- Made the uploads directory unwritable
- got rid of PHP's tmp directory
I was using only the browser uploader for my tests, however. I think that the browser uploader would fail to print messages more often than the Flash / Ajax uploader, because of the redirection issue.
- Resolution set to fixed
- Status changed from assigned to closed

Updated patch to include a fix for a related problem in wp-admin/media-upload.php
The problem is that it redirects too soon before checking for upload errors. You can test this problem by not having a writable uploads directory and trying to upload from the "Add new" page under Media--nothing happens and you get no feedback.