[wp-trac] [WordPress Trac] #19888: We need a recursive version of wp_parse_args(), namely wp_parse_args_r()

WordPress Trac wp-trac at lists.automattic.com
Tue Jan 24 17:14:14 UTC 2012


#19888: We need a recursive version of wp_parse_args(), namely wp_parse_args_r()
-------------------------+------------------------------
 Reporter:  Master Jake  |       Owner:
     Type:  enhancement  |      Status:  new
 Priority:  normal       |   Milestone:  Awaiting Review
Component:  General      |     Version:
 Severity:  normal       |  Resolution:
 Keywords:               |
-------------------------+------------------------------

Comment (by nacin):

 I'll bite. I can only think of a single instance in all of core where we
 nest wp_parse_args() calls, and that would be in WP_Admin_Bar::add_node(),
 which calls wp_parse_args() not only on $args, but also on $args['meta'].

 Normally, wp_parse_args() is nothing more than an array_merge(). The only
 reason we have a helper function is because wp_parse_args() transparently
 handles query string notation ("key=value&key2=value") as well. This works
 effectively for our functions that take an $args argument, but doesn't
 translate to a recursive situation. And since we wouldn't have the helper
 if it weren't for this benefit, I don't see the need for a utility
 function.

 To me, it sounds like any plugin wanting to do a recursive merge of
 defaults should be doing this on their own, and to their specifications.
 Given that arguments often store arrays themselves, doing a recursive
 merge could cause unforeseen problems.

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


More information about the wp-trac mailing list