Opened 11 years ago
Closed 10 years ago
#28204 closed defect (bug) (fixed)
`media_sideload_image()` tries to unlink a WP_Error object.
Reported by: | georgestephanis | Owned by: | wonderboymusic |
---|---|---|---|
Milestone: | 4.0 | Priority: | low |
Severity: | minor | Version: | 2.7 |
Component: | Media | Keywords: | has-patch |
Focuses: | Cc: |
Description
Traced back to: https://core.trac.wordpress.org/changeset/8959/trunk/wp-admin/includes/media.php by @noel
Long story short, the conditional block will only be entered if $tmp
is a WP_Error object, then once in, it will try to unlink $file_array['tmp_name']
-- which was just set equal to $tmp
and is therefore also a WP_Error object and not a file path, so unlink will always fail!
Also, instead of setting $file_array['tmp_name']
to an empty string and causing it to fail and pass back a WP_Error later, let's just pass back the WP_Error directly.
Attachments (1)
Change History (4)
Note: See
TracTickets for help on using
tickets.
Related: #7732