REST API: Use strict in_array() checks for the list of usernames blacklisted via illegal_user_logins filter.

See #48839.

git-svn-id: https://develop.svn.wordpress.org/trunk@46804 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Sergey Biryukov
2019-11-29 22:02:30 +00:00
parent e3261b601f
commit b5ed00dc82
4 changed files with 5 additions and 5 deletions
+2 -2
View File
@@ -1584,7 +1584,7 @@ function wp_insert_user( $userdata ) {
*/
$illegal_logins = (array) apply_filters( 'illegal_user_logins', array() );
if ( in_array( strtolower( $user_login ), array_map( 'strtolower', $illegal_logins ) ) ) {
if ( in_array( strtolower( $user_login ), array_map( 'strtolower', $illegal_logins ), true ) ) {
return new WP_Error( 'invalid_username', __( 'Sorry, that username is not allowed.' ) );
}
@@ -2503,7 +2503,7 @@ function register_new_user( $user_login, $user_email ) {
} else {
/** This filter is documented in wp-includes/user.php */
$illegal_user_logins = (array) apply_filters( 'illegal_user_logins', array() );
if ( in_array( strtolower( $sanitized_user_login ), array_map( 'strtolower', $illegal_user_logins ) ) ) {
if ( in_array( strtolower( $sanitized_user_login ), array_map( 'strtolower', $illegal_user_logins ), true ) ) {
$errors->add( 'invalid_username', __( '<strong>ERROR</strong>: Sorry, that username is not allowed.' ) );
}
}