[wp-trac] [WordPress Trac] #64149: Media / Attachments REST API endpoint: cast args to array before sending to wp_slash > wp_insert_attachment

WordPress Trac noreply at wordpress.org
Sun Oct 26 21:06:51 UTC 2025


#64149: Media / Attachments REST API endpoint: cast args to array before sending to
wp_slash > wp_insert_attachment
---------------------------------------------+-------------------------
 Reporter:  ramonopoly                       |       Owner:  ramonopoly
     Type:  defect (bug)                     |      Status:  closed
 Priority:  high                             |   Milestone:  6.9
Component:  REST API                         |     Version:
 Severity:  normal                           |  Resolution:  fixed
 Keywords:  has-patch has-unit-tests commit  |     Focuses:  rest-api
---------------------------------------------+-------------------------
Changes (by ramonopoly):

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


Comment:

 In [changeset:"61065" 61065]:
 {{{
 #!CommitTicketReference repository="" revision="61065"
 Media / Attachments REST API endpoint: cast args to array before sending
 to wp_slash > wp_insert_attachment

 This commit casts the object returned by `prepare_item_for_database()` to
 an array. Without doing so, `wp_slash()` returns the object unchanged,
 meaning string values within the object wouldn't be properly escaped for
 database insertion.

 Follow-up to [64035]

 Props ramonopoly, westonruter, mukesh27, justlevine.

 Fixes #64149.
 }}}

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


More information about the wp-trac mailing list