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

WordPress Trac noreply at wordpress.org
Wed Aug 30 12:12:07 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 mrasharirfan):

 Hi,

 I have created a patch to include the fourth parameter to return WP_Error
 object just in case any error occurs. IMHO, I agree with @flixos90. As the
 documentation says, that {{{media_handle_upload()}}} returns either ID of
 the attachment or a WP_Error object on failure, so backward compatibility
 will not be an issue.

 Cheers!

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


More information about the wp-trac mailing list