A failed upload loses its error messages
|Reported by:||filosofo||Owned by:||westi|
|Severity:||major||Keywords:||media_upload_form_handler has-patch upload|
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.