WordPress.org

Make WordPress Core

Ticket #16484: 16484.patch

File 16484.patch, 1.4 KB (added by SergeyBiryukov, 7 years ago)
  • wp-includes/user.php

     
    10161016                        $_selected = selected( $user->ID, $selected, false );
    10171017                        if ( $_selected )
    10181018                                $found_selected = true;
    1019                         $display = !empty($user->$show) ? $user->$show : '('. $user->user_login . ')';
     1019                        $display = isset($user->$show) && strlen($user->$show) ? $user->$show : '('. $user->user_login . ')';
    10201020                        $output .= "\t<option value='$user->ID'$_selected>" . esc_html($display) . "</option>\n";
    10211021                }
    10221022
    10231023                if ( $include_selected && ! $found_selected && ( $selected > 0 ) ) {
    10241024                        $user = get_userdata( $selected );
    10251025                        $_selected = selected( $user->ID, $selected, false );
    1026                         $display = !empty($user->$show) ? $user->$show : '('. $user->user_login . ')';
     1026                        $display = isset($user->$show) && strlen($user->$show) ? $user->$show : '('. $user->user_login . ')';
    10271027                        $output .= "\t<option value='$user->ID'$_selected>" . esc_html($display) . "</option>\n";
    10281028                }
    10291029
     
    14011401        //Remove any non-printable chars from the login string to see if we have ended up with an empty username
    14021402        $user_login = trim($user_login);
    14031403
    1404         if ( empty($user_login) )
     1404        if ( !isset($user_login) || !strlen($user_login) )
    14051405                return new WP_Error('empty_user_login', __('Cannot create a user with an empty login name.') );
    14061406
    14071407        if ( !$update && username_exists( $user_login ) )