Make WordPress Core

Ticket #40888: 40888.patch

File 40888.patch, 1.6 KB (added by menakas, 7 years ago)

Patch to address issue for user_login - use is_string to check value

  • src/wp-login.php

     
    285285function retrieve_password() {
    286286        $errors = new WP_Error();
    287287
    288         if ( empty( $_POST['user_login'] ) ) {
     288        if ( ! is_string ($_POST['user_login'] ) ) {
     289                $errors->add('username_not_string', __('<strong>ERROR</strong>: Enter a string value of username or email address.'));
     290        } elseif ( empty( $_POST['user_login'] ) ) {
    289291                $errors->add('empty_username', __('<strong>ERROR</strong>: Enter a username or email address.'));
    290292        } elseif ( strpos( $_POST['user_login'], '@' ) ) {
    291293                $user_data = get_user_by( 'email', trim( wp_unslash( $_POST['user_login'] ) ) );
     
    528530
    529531        login_header(__('Lost Password'), '<p class="message">' . __('Please enter your username or email address. You will receive a link to create a new password via email.') . '</p>', $errors);
    530532
    531         $user_login = isset($_POST['user_login']) ? wp_unslash($_POST['user_login']) : '';
     533        $user_login = isset($_POST['user_login']) && is_string($_POST['user_login']) ? wp_unslash($_POST['user_login']) : '';
    532534
    533535?>
    534536
     
    698700        $user_login = '';
    699701        $user_email = '';
    700702        if ( $http_post ) {
    701                 $user_login = isset( $_POST['user_login'] ) ? $_POST['user_login'] : '';
     703                $user_login = isset( $_POST['user_login'] ) && is_string( $_POST['user_login']) ? $_POST['user_login'] : '';
    702704                $user_email = isset( $_POST['user_email'] ) ? wp_unslash( $_POST['user_email'] ) : '';
    703705                $errors = register_new_user($user_login, $user_email);
    704706                if ( !is_wp_error($errors) ) {