Make WordPress Core

Ticket #35087: 35087.diff

File 35087.diff, 1.2 KB (added by josephscott, 8 years ago)
  • src/wp-includes/functions.php

     
    33713371                 * This is simple. Could at some point wrap array_column()
    33723372                 * if we knew we had an array of arrays.
    33733373                 */
    3374                 foreach ( $list as $key => $value ) {
     3374                foreach ( (array) $list as $key => $value ) {
    33753375                        if ( is_object( $value ) ) {
    33763376                                $list[ $key ] = $value->$field;
    33773377                        } else {
  • tests/phpunit/tests/functions/listFilter.php

     
    110110                $this->assertEquals( array( 'f' => 'foo', 'b' => 'bar', 'z' => 'baz' ), $list );
    111111        }
    112112
     113        /**
     114         * @ticket 35087
     115         */
     116        function test_wp_list_pluck_non_array() {
     117                $list = wp_list_pluck( false, 'name' );
     118                $this->assertEquals( [ 0 => null ], $list );
     119        }
     120
    113121        function test_filter_object_list_nested_array_and() {
    114122                $list = wp_filter_object_list( $this->object_list, array( 'field4' => array( 'blue' ) ), 'AND' );
    115123                $this->assertEquals( 1, count( $list ) );