From eea1fd30c28dcdd3350b47391338b6d5fe2f90a5 Mon Sep 17 00:00:00 2001 From: Sergey Biryukov Date: Wed, 4 Mar 2020 12:00:06 +0000 Subject: [PATCH] General: Correct the default value of the `$defaults` parameter in `wp_parse_args()` to match the documented type. Props subrataemfluence. See #45643. Built from https://develop.svn.wordpress.org/trunk@47429 git-svn-id: http://core.svn.wordpress.org/trunk@47216 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-includes/functions.php | 7 ++++--- wp-includes/version.php | 2 +- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/wp-includes/functions.php b/wp-includes/functions.php index 088fe9d07f..658afaad3c 100644 --- a/wp-includes/functions.php +++ b/wp-includes/functions.php @@ -4349,10 +4349,11 @@ function smilies_init() { * @since 2.3.0 `$args` can now also be an object. * * @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. */ -function wp_parse_args( $args, $defaults = '' ) { +function wp_parse_args( $args, $defaults = array() ) { if ( is_object( $args ) ) { $parsed_args = get_object_vars( $args ); } elseif ( is_array( $args ) ) { @@ -4361,7 +4362,7 @@ function wp_parse_args( $args, $defaults = '' ) { wp_parse_str( $args, $parsed_args ); } - if ( is_array( $defaults ) ) { + if ( is_array( $defaults ) && $defaults ) { return array_merge( $defaults, $parsed_args ); } return $parsed_args; diff --git a/wp-includes/version.php b/wp-includes/version.php index a32f5206b2..576c406219 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -13,7 +13,7 @@ * * @global string $wp_version */ -$wp_version = '5.5-alpha-47428'; +$wp_version = '5.5-alpha-47429'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.