Make WordPress Core

Changeset 47429


Ignore:
Timestamp:
03/04/2020 11:58:31 AM (5 years ago)
Author:
SergeyBiryukov
Message:

General: Correct the default value of the $defaults parameter in wp_parse_args() to match the documented type.

Props subrataemfluence.
See #45643.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/functions.php

    r47427 r47429  
    43504350 *
    43514351 * @param string|array|object $args     Value to merge with $defaults.
    4352  * @param array               $defaults Optional. Array that serves as the defaults. Default empty.
     4352 * @param array               $defaults Optional. Array that serves as the defaults.
     4353 *                                      Default empty array.
    43534354 * @return array Merged user defined values with defaults.
    43544355 */
    4355 function wp_parse_args( $args, $defaults = '' ) {
     4356function wp_parse_args( $args, $defaults = array() ) {
    43564357    if ( is_object( $args ) ) {
    43574358        $parsed_args = get_object_vars( $args );
     
    43624363    }
    43634364
    4364     if ( is_array( $defaults ) ) {
     4365    if ( is_array( $defaults ) && $defaults ) {
    43654366        return array_merge( $defaults, $parsed_args );
    43664367    }
Note: See TracChangeset for help on using the changeset viewer.