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

WordPress Trac noreply at wordpress.org
Wed Aug 30 15:03:09 UTC 2017


#41726: `media_handle_upload()` may unexpectedly return 0 on error
---------------------------------------------+-----------------------------
 Reporter:  flixos90                         |       Owner:  mrasharirfan
     Type:  defect (bug)                     |      Status:  closed
 Priority:  normal                           |   Milestone:  Awaiting
Component:  Media                            |  Review
 Severity:  normal                           |     Version:
 Keywords:  good-first-bug has-patch commit  |  Resolution:  fixed
                                             |     Focuses:
---------------------------------------------+-----------------------------
Changes (by joemcgill):

 * status:  assigned => closed
 * resolution:   => fixed


Comment:

 In [changeset:"41323"]:
 {{{
 #!CommitTicketReference repository="" revision="41323"
 Media: Ensure 'media_handle_upload()' returns 'WP_Error' on failure.

 This fixes an issue where failures when inserting the attachment post via
 `wp_insert_attachment()` would result in a return value of `0` instead of
 a
 `WP_Error` object, as documented. This is addressed by passing `true` as
 the
 fourth param (added in WP 4.7.0) when calling `wp_insert_attachment()`.

 Props mrasharirfan, flixos90.
 Fixes #41726.
 }}}

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


More information about the wp-trac mailing list