[wp-trac] [WordPress Trac] #56650: Add more error checking to WP_List_Util::pluck

WordPress Trac noreply at wordpress.org
Sat Feb 25 10:57:29 UTC 2023


#56650: Add more error checking to WP_List_Util::pluck
---------------------------------------------+-----------------------
 Reporter:  afragen                          |       Owner:  audrasjb
     Type:  defect (bug)                     |      Status:  closed
 Priority:  normal                           |   Milestone:  6.2
Component:  General                          |     Version:
 Severity:  normal                           |  Resolution:  fixed
 Keywords:  has-patch has-unit-tests commit  |     Focuses:
---------------------------------------------+-----------------------
Changes (by SergeyBiryukov):

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


Comment:

 In [changeset:"55423" 55423]:
 {{{
 #!CommitTicketReference repository="" revision="55423"
 General: Add more error checking to `WP_List_Util::pluck()`.

 Values for the input array in `WP_List_Util::pluck()` or `wp_list_pluck()`
 must be either objects or arrays.

 This commit adds a check to ensure that the value retrieved in the loop is
 an array before treating it as such, and throws a `_doing_it_wrong()`
 notice if it is neither an object nor an array.

 Follow-up to [14108], [15686], [18602], [28900], [38928].

 Props afragen, costdev, audrasjb.
 Fixes #56650.
 }}}

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


More information about the wp-trac mailing list