diff --git a/wp-includes/formatting.php b/wp-includes/formatting.php index 9c49b97b56..905b07b598 100644 --- a/wp-includes/formatting.php +++ b/wp-includes/formatting.php @@ -2132,19 +2132,15 @@ function sanitize_user( $username, $strict = false ) { * * @since 3.0.0 * - * @param string $key String key - * @return string Sanitized key + * @param string $key String key. + * @return string Sanitized key. */ function sanitize_key( $key ) { - $raw_key = $key; + $sanitized_key = ''; - if ( ! is_string( $key ) ) { - $key = ''; - } - - if ( '' !== $key ) { - $key = strtolower( $key ); - $key = preg_replace( '/[^a-z0-9_\-]/', '', $key ); + if ( is_scalar( $key ) ) { + $sanitized_key = strtolower( $key ); + $sanitized_key = preg_replace( '/[^a-z0-9_\-]/', '', $sanitized_key ); } /** @@ -2152,10 +2148,10 @@ function sanitize_key( $key ) { * * @since 3.0.0 * - * @param string $key Sanitized key. - * @param string $raw_key The key prior to sanitization. + * @param string $sanitized_key Sanitized key. + * @param string $key The key prior to sanitization. */ - return apply_filters( 'sanitize_key', $key, $raw_key ); + return apply_filters( 'sanitize_key', $sanitized_key, $key ); } /** diff --git a/wp-includes/version.php b/wp-includes/version.php index 65c5c4c81c..cf5fb84914 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -16,7 +16,7 @@ * * @global string $wp_version */ -$wp_version = '5.9-beta2-52369'; +$wp_version = '5.9-beta2-52370'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.