Make WordPress Core

Changeset 53045


Ignore:
Timestamp:
04/01/2022 05:54:37 AM (3 years ago)
Author:
peterwilsoncc
Message:

General: Validate input of wp_list_pluck().

wp_list_pluck() is used by WordPress to pluck items from a list. Of course, this requires a list. This validates the input of wp_list_pluck() to ensure it is a list.

This matches the behaviour of wp_list_sort() and wp_filter_object_list().

Props marv2, davidbaumwald, mkox, SergeyBiryukov, dd32.
Fixes #54751.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/functions.php

    r53044 r53045  
    51775177 */
    51785178function wp_list_pluck( $list, $field, $index_key = null ) {
     5179    if ( ! is_array( $list ) ) {
     5180        return array();
     5181    }
     5182
    51795183    $util = new WP_List_Util( $list );
    51805184
Note: See TracChangeset for help on using the changeset viewer.