[wp-trac] [WordPress Trac] #53988: remove duplicate code in wp_list_filter()

WordPress Trac noreply at wordpress.org
Tue Nov 9 01:09:25 UTC 2021


#53988: remove duplicate code in wp_list_filter()
------------------------------+-----------------------------
 Reporter:  pbearne           |       Owner:  hellofromTonya
     Type:  enhancement       |      Status:  closed
 Priority:  normal            |   Milestone:  5.9
Component:  General           |     Version:
 Severity:  normal            |  Resolution:  fixed
 Keywords:  has-patch commit  |     Focuses:
------------------------------+-----------------------------
Changes (by hellofromTonya):

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


Comment:

 In [changeset:"52066" 52066]:
 {{{
 #!CommitTicketReference repository="" revision="52066"
 General: Convert `wp_list_filter()` into a wrapper for
 `wp_filter_object_list()`.

 The code in `wp_list_filter()` was a duplicate of
 `wp_filter_object_list()`, minus the `WP_List_Util::pluck()` (used when
 `$field` is configured).

 In testing the wrapper, discovered an edge case (and potential bug) in
 `WP_List_Util::filter()` where if the operator matches an empty array was
 returned without resetting the output property. Without that property
 being set correctly, `WP_List_Util::get_output()` was not correct. This
 commit also fixes this by resetting the property to an empty array.

 Follow-up to [15686], [17427], [38928], [51044].

 Props pbearne, sergeybiryukov, hellofromTonya.
 Fixes #53988.
 }}}

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


More information about the wp-trac mailing list