[wp-trac] [WordPress Trac] #39380: wp_update_comment can cause database error with new filter (was: wp_update_comment strips data from passed array)

WordPress Trac noreply at wordpress.org
Sat Dec 24 15:51:34 UTC 2016


#39380: wp_update_comment can cause database error with new filter
--------------------------+--------------------
 Reporter:  dshanske      |       Owner:
     Type:  defect (bug)  |      Status:  new
 Priority:  normal        |   Milestone:  4.7.1
Component:  Comments      |     Version:  4.6
 Severity:  normal        |  Resolution:
 Keywords:                |     Focuses:
--------------------------+--------------------
Changes (by dshanske):

 * milestone:  Awaiting Review => 4.7.1


Old description:

> In 4.6, the comment data array was passed into the edit_comment action.
> In 4.7, the wp_update_comment_data filter was added to wp_update_comment.
>
> However, wp_array_slice_assoc is called to filter keys out of the array
> before it is passed to both.
>
> It should be called only to filter the data going into the database. By
> adding a key to the array at the filter, for example, you can cause a
> database error.
>
> By removing extra keys from the data before it hits edit_comment, it
> makes it impossible to pass data to be saved as metadata.

New description:

 In 4.6, the comment data array was passed into the edit_comment action. In
 4.7, the wp_update_comment_data filter was added to wp_update_comment.

 However, wp_array_slice_assoc is called to filter keys out of the array
 before it is passed to both.

 It should be called after and only to filter the data going into the
 database. By adding a key to the array at the filter you can cause a
 database error.

 By removing extra keys from the data before it hits edit_comment, it also
 makes it impossible to pass data to be saved as metadata.

--

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


More information about the wp-trac mailing list