[wp-trac] [WordPress Trac] #22342: WP_DEBUG "undefined index" notices in get_metadata() for empty arrays

WordPress Trac noreply at wordpress.org
Wed Jul 10 20:43:05 UTC 2013


#22342: WP_DEBUG "undefined index" notices in get_metadata() for empty arrays
-------------------------------------------------+-------------------------
 Reporter:  doublesharp                          |       Owner:
     Type:  enhancement                          |      Status:  new
 Priority:  normal                               |   Milestone:  Awaiting
Component:  Warnings/Notices                     |  Review
 Severity:  minor                                |     Version:  3.1
 Keywords:  has-patch needs-testing dev-         |  Resolution:
  feedback 2nd-opinion                           |
-------------------------------------------------+-------------------------

Comment (by nacin):

 While I am not a huge fan of how this is implemented, I don't think there
 is a bug here, and it's not impossible to return an array.

 It seems the onus is on the plugin author to look at the `$single`
 argument passed to the get_{$meta_type}_metadata filter, and obey it. As
 in, if you want to return an array, then do so if $single, but wrap it in
 an array (with key 0 being your array) if not $single.

--
Ticket URL: <http://core.trac.wordpress.org/ticket/22342#comment:4>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list