[wp-trac] [WordPress Trac] #59774: Undefined array key when using wp_list_pluck function

WordPress Trac noreply at wordpress.org
Sun Feb 25 23:37:27 UTC 2024


#59774: Undefined array key when using wp_list_pluck function
-------------------------------------------------+-------------------------
 Reporter:  iamarunchaitanyajami                 |       Owner:
                                                 |  hellofromTonya
     Type:  defect (bug)                         |      Status:  reopened
 Priority:  normal                               |   Milestone:  6.5
Component:  General                              |     Version:  5.1
 Severity:  normal                               |  Resolution:
 Keywords:  has-patch has-testing-info has-      |     Focuses:
  unit-tests commit                              |
-------------------------------------------------+-------------------------
Changes (by dd32):

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


Comment:

 This has caused a regression for arrays of objects which have magic
 methods for getting properties.

 For example:
 {{{
 wp_list_pluck( [ get_user_by('ID', 1) ], 'user_email' );
 }}}
 return an empty {{{array()}}} while {{{get_user_by('ID', 1)->user_email}}}
 returns a string.

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


More information about the wp-trac mailing list