﻿id	summary	reporter	owner	description	type	status	priority	milestone	component	version	severity	resolution	keywords	cc
19888	We need a recursive version of wp_parse_args(), namely wp_parse_args_r()	Master Jake		"Currently, wp_parse_args() will merge a collection of possible arguments into a collection of defaults, overriding the defaults when necessary. The issue arises when one of the supplied arguments is an array itself (e.g. an array within an array). Intuitively, one might expect wp_parse_args to treat the inner array as its own instance and merge semi-separately, but it doesn't. We should add this functionality so that users (and possibly the core as well) can start taking advantage of it. It could follow PHP's standard naming convention of suffixing the function name with _r since it's recursive.

An example using wp_parse_args():
{{{
#!php
$args = array(
	'inner' => array(
		'key1' => 'value1'
	)
);

$defaults = array(
	'rootkey1' => 'rootvalue1',
	'inner' => array(
		'key2' => 'value2',
		'key3' => 'value3'
	)
);

$merged = wp_parse_args( $args, $defaults );

/*
Contents of $merged:

Array
(
	[rootkey1] => rootvalue1
	[inner] => Array
		(
			[key1] => value1
		)
)

*/
}}}

The same example using the new wp_parse_args_r():
{{{
#!php
$args = array(
	'inner' => array(
		'key1' => 'value1'
	)
);

$defaults = array(
	'rootkey1' => 'rootvalue1',
	'inner' => array(
		'key2' => 'value2',
		'key3' => 'value3'
	)
);

$merged = wp_parse_args( $args, $defaults );

/*
Contents of $merged:

Array
(
	[rootkey1] => rootvalue1
	[inner] => Array
		(
			[key1] => value1
			[key2] => value2
			[key3] => value3
		)
)

*/
}}}

Notice the preserved content of the inner array. This new recursive function should perform this way for as many levels down as necessary (hence being a recursive function)."	enhancement	closed	normal		General		normal	wontfix		chappellind@…
