[wp-trac] [WordPress Trac] #41726: `media_handle_upload()` may unexpectedly return 0 on error

WordPress Trac noreply at wordpress.org
Sat Aug 26 09:46:30 UTC 2017


#41726: `media_handle_upload()` may unexpectedly return 0 on error
----------------------------------------+------------------------------
 Reporter:  flixos90                    |       Owner:
     Type:  defect (bug)                |      Status:  new
 Priority:  normal                      |   Milestone:  Awaiting Review
Component:  Media                       |     Version:
 Severity:  normal                      |  Resolution:
 Keywords:  needs-patch good-first-bug  |     Focuses:
----------------------------------------+------------------------------

Comment (by flixos90):

 @joemcgill
 I wasn't aware this has only been there since 4.7, this would make sense
 to explain why it's not correctly handled in `media_handle_upload()`.

 Regarding BC, I think it should be safe to fix this for the following
 reasons:

 * People right now need to check `is_wp_error()` anyway. If they have an
 extra condition to check whether the return value is 0, that will just be
 skipped, but it would very likely just be another error handler anyways.
 * It has always been documented to only return `WP_Error` on errors, as
 you've pointed out.

 Let's move this into 4.9 if you agree.

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


More information about the wp-trac mailing list