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

WordPress Trac noreply at wordpress.org
Tue Feb 27 07:15:13 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:  needs-patch           |     Focuses:
----------------------------------+-----------------------------

Comment (by jamescollins):

 This change is negatively affecting WooCommerce core, specifically the
 Order meta data retrieval, and likely other data types.


 https://github.com/woocommerce/woocommerce/blob/707c555091503d30b49537b7074b3072b4a86a1c/plugins/woocommerce/includes/abstracts
 /abstract-wc-data.php#L367

 These are arrays of objects.

 Changing
 {{{#!php
 if ( property_exists( $value, $field ) ) {
 }}}
 to
 {{{#!php
 if ( property_exists( $value, $field ) || isset( $value->$field )  ) {
 }}}

 As suggested by @dd32 in #comment:18,  resolves the issue that we have
 observed.

 Thanks to @om4csaba for helping me discover this.

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


More information about the wp-trac mailing list