Make WordPress Core

Changeset 48205


Ignore:
Timestamp:
06/28/2020 09:02:18 PM (4 years ago)
Author:
SergeyBiryukov
Message:

Bootstrap/Load: Make sure add_magic_quotes() does not inappropriately recast non-string data types to string.

Props donmhico, jrf, Veraxus, Rarst.
Fixes #48605.

Location:
trunk
Files:
1 added
1 edited

Legend:

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

    r48199 r48205  
    12201220 *
    12211221 * @since 0.71
     1222 * @since 5.5.0 Non-string values are left untouched.
    12221223 *
    12231224 * @param array $array Array to walk while sanitizing contents.
     
    12281229        if ( is_array( $v ) ) {
    12291230            $array[ $k ] = add_magic_quotes( $v );
     1231        } elseif ( ! is_string( $v ) ) {
     1232            continue;
    12301233        } else {
    12311234            $array[ $k ] = addslashes( $v );
    12321235        }
    12331236    }
     1237
    12341238    return $array;
    12351239}
Note: See TracChangeset for help on using the changeset viewer.