[wp-trac] [WordPress Trac] #47868: wp_delete_attachment returning successfully, deleting all DB data, but NOT deleting files, and NOT returning false

WordPress Trac noreply at wordpress.org
Tue Aug 20 04:16:29 UTC 2019


#47868: wp_delete_attachment returning successfully, deleting all DB data, but NOT
deleting files, and NOT returning false
------------------------------------+------------------------------
 Reporter:  Jossnaz                 |       Owner:  (none)
     Type:  defect (bug)            |      Status:  new
 Priority:  normal                  |   Milestone:  Awaiting Review
Component:  Media                   |     Version:
 Severity:  normal                  |  Resolution:
 Keywords:  has-patch dev-feedback  |     Focuses:
------------------------------------+------------------------------
Changes (by donmhico):

 * keywords:  has-patch => has-patch dev-feedback


Comment:

 [https://core.trac.wordpress.org/attachment/ticket/47868/47868.2.diff
 47868.2.diff] fixes the failing REST test. The problem is with the
 creation of the dummy attachment. It's not creating proper metas for the
 attachment which will result to `wp_delete_attachment()` returning `false`
 since no file was deleted. Hence the response status isn't `200` making
 the test fail.

 What I did is to make the test use `$this->_make_attachment()` to create
 the dummy attachment.

 We're gonna need to ask for more insights from core devs regarding this.

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


More information about the wp-trac mailing list