Make WordPress Core


Ignore:
Timestamp:
11/29/2019 10:02:30 PM (5 years ago)
Author:
SergeyBiryukov
Message:

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

See #48839.

File:
1 edited

Legend:

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

    r46685 r46804  
    15851585    $illegal_logins = (array) apply_filters( 'illegal_user_logins', array() );
    15861586
    1587     if ( in_array( strtolower( $user_login ), array_map( 'strtolower', $illegal_logins ) ) ) {
     1587    if ( in_array( strtolower( $user_login ), array_map( 'strtolower', $illegal_logins ), true ) ) {
    15881588        return new WP_Error( 'invalid_username', __( 'Sorry, that username is not allowed.' ) );
    15891589    }
     
    25042504        /** This filter is documented in wp-includes/user.php */
    25052505        $illegal_user_logins = (array) apply_filters( 'illegal_user_logins', array() );
    2506         if ( in_array( strtolower( $sanitized_user_login ), array_map( 'strtolower', $illegal_user_logins ) ) ) {
     2506        if ( in_array( strtolower( $sanitized_user_login ), array_map( 'strtolower', $illegal_user_logins ), true ) ) {
    25072507            $errors->add( 'invalid_username', __( '<strong>ERROR</strong>: Sorry, that username is not allowed.' ) );
    25082508        }
Note: See TracChangeset for help on using the changeset viewer.