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

Props donmhico, jrf, Veraxus, Rarst.
Fixes #48605.
Built from https://develop.svn.wordpress.org/trunk@48205


git-svn-id: http://core.svn.wordpress.org/trunk@47974 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Sergey Biryukov 2020-06-28 21:04:02 +00:00
parent 66591d00ab
commit d25cc189be
2 changed files with 5 additions and 1 deletions

View File

@ -1219,6 +1219,7 @@ function wp_removable_query_args() {
* Walks the array while sanitizing the contents.
*
* @since 0.71
* @since 5.5.0 Non-string values are left untouched.
*
* @param array $array Array to walk while sanitizing contents.
* @return array Sanitized $array.
@ -1227,10 +1228,13 @@ function add_magic_quotes( $array ) {
foreach ( (array) $array as $k => $v ) {
if ( is_array( $v ) ) {
$array[ $k ] = add_magic_quotes( $v );
} elseif ( ! is_string( $v ) ) {
continue;
} else {
$array[ $k ] = addslashes( $v );
}
}
return $array;
}

View File

@ -13,7 +13,7 @@
*
* @global string $wp_version
*/
$wp_version = '5.5-alpha-48204';
$wp_version = '5.5-alpha-48205';
/**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.