Opened 12 years ago
Closed 12 years ago
#28204 closed defect (bug) (fixed)
`media_sideload_image()` tries to unlink a WP_Error object.
| Reported by: | georgestephanis | Owned by: | wonderboymusic |
|---|---|---|---|
| Priority: | low | Milestone: | 4.0 |
| Component: | Media | Version: | 2.7 |
| Severity: | minor | Keywords: | has-patch |
| Cc: | Focuses: |
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.
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)
Related: #7732