[wp-trac] [WordPress Trac] #28204: `media_sideload_image()` tries to unlink a WP_Error object.
WordPress Trac
noreply at wordpress.org
Sat May 10 16:36:08 UTC 2014
#28204: `media_sideload_image()` tries to unlink a WP_Error object.
-----------------------------+-----------------------------
Reporter: georgestephanis | Owner:
Type: defect (bug) | Status: new
Priority: low | Milestone: Awaiting Review
Component: Media | Version: 2.7
Severity: minor | Keywords: has-patch
Focuses: |
-----------------------------+-----------------------------
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.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/28204>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list