General: Correct the default value of the $defaults
parameter in wp_parse_args()
to match the documented type.
Props subrataemfluence. See #45643. git-svn-id: https://develop.svn.wordpress.org/trunk@47429 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
047f6e4bef
commit
7a4f9cc9a6
@ -4349,10 +4349,11 @@ function smilies_init() {
|
|||||||
* @since 2.3.0 `$args` can now also be an object.
|
* @since 2.3.0 `$args` can now also be an object.
|
||||||
*
|
*
|
||||||
* @param string|array|object $args Value to merge with $defaults.
|
* @param string|array|object $args Value to merge with $defaults.
|
||||||
* @param array $defaults Optional. Array that serves as the defaults. Default empty.
|
* @param array $defaults Optional. Array that serves as the defaults.
|
||||||
|
* Default empty array.
|
||||||
* @return array Merged user defined values with defaults.
|
* @return array Merged user defined values with defaults.
|
||||||
*/
|
*/
|
||||||
function wp_parse_args( $args, $defaults = '' ) {
|
function wp_parse_args( $args, $defaults = array() ) {
|
||||||
if ( is_object( $args ) ) {
|
if ( is_object( $args ) ) {
|
||||||
$parsed_args = get_object_vars( $args );
|
$parsed_args = get_object_vars( $args );
|
||||||
} elseif ( is_array( $args ) ) {
|
} elseif ( is_array( $args ) ) {
|
||||||
@ -4361,7 +4362,7 @@ function wp_parse_args( $args, $defaults = '' ) {
|
|||||||
wp_parse_str( $args, $parsed_args );
|
wp_parse_str( $args, $parsed_args );
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( is_array( $defaults ) ) {
|
if ( is_array( $defaults ) && $defaults ) {
|
||||||
return array_merge( $defaults, $parsed_args );
|
return array_merge( $defaults, $parsed_args );
|
||||||
}
|
}
|
||||||
return $parsed_args;
|
return $parsed_args;
|
||||||
|
Loading…
Reference in New Issue
Block a user