[wp-trac] [WordPress Trac] #31316: wp_list_pluck unexpectedly returns id indexed array instead of plucked values with index_key = null

WordPress Trac noreply at wordpress.org
Fri Feb 13 02:26:39 UTC 2015


#31316: wp_list_pluck unexpectedly returns id indexed array instead of plucked
values with index_key = null
------------------------------------+------------------------------
 Reporter:  adamsilverstein         |       Owner:
     Type:  defect (bug)            |      Status:  new
 Priority:  normal                  |   Milestone:  Awaiting Review
Component:  General                 |     Version:  3.1
 Severity:  normal                  |  Resolution:
 Keywords:  has-patch dev-feedback  |     Focuses:
------------------------------------+------------------------------

Comment (by dd32):

 Replying to [comment:5 adamsilverstein]:
 > re: "plugins (or core) expecting this behaviour." - I'm not sure why
 they would expect this bahaviour, its completely unexpected - thats not
 what the function doc block states the function is going to return.

 Regardless of what the Docblock suggests, it's what the code explicitly
 did (by using `$key`) and how it acted. Documentation can be wrong, and
 unfortunately in the past WordPress's documentation has lacked in both
 details and matching the exact output from functions, while we have far
 better documentation now, it's still possible there's bugs.

 For example, look at how it was
 [https://core.trac.wordpress.org/browser/tags/3.1/wp-
 includes/functions.php#L3085 when introduced in 3.1], the documentation
 remained the same until 4.0 when return docs were added in r28936.

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


More information about the wp-trac mailing list