[wp-trac] [WordPress Trac] #54751: Invalid argument in class-wp-list-util.php

WordPress Trac noreply at wordpress.org
Wed Jan 5 16:44:28 UTC 2022


#54751: Invalid argument in class-wp-list-util.php
-------------------------------------------------+-------------------------
 Reporter:  marv2                                |       Owner:  (none)
     Type:  defect (bug)                         |      Status:  new
 Priority:  normal                               |   Milestone:  6.0
Component:  General                              |     Version:  3.1
 Severity:  normal                               |  Resolution:
 Keywords:  good-first-bug needs-patch needs-    |     Focuses:
  unit-tests                                     |
-------------------------------------------------+-------------------------
Changes (by davidbaumwald):

 * keywords:   => good-first-bug needs-patch needs-unit-tests
 * version:  5.8.2 => 3.1
 * milestone:  Awaiting Review => 6.0


Comment:

 @marv2 Welcome to WordPress Core Trac, and thanks for the ticket!

 This can happen when using the `wp_list_pluck` function which, in the
 underlying `WP_List_Util` class expects the list to be an array.

 I think adding some checks before iterating over the array in
 `WP_List_Util->pluck` to ensure the list is an actual array would be nice
 to get rid of this warning.  Perhaps throwing a `doing_it_wrong` is also
 needed?

 Also, going to tag this for `needs-unit-tests`.  It would be good to have
 some "unhpappy path" tests to check some invalid types sent to the `pluck`
 method.

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


More information about the wp-trac mailing list