Ticket #16484: 16484.2.diff
| File 16484.2.diff, 3.4 KB (added by MikeHansenMe, 8 months ago) |
|---|
-
wp-includes/capabilities.php
526 526 $value = trim( $value ); 527 527 } 528 528 529 if ( ! $value)529 if ( !isset($value) ) 530 530 return false; 531 531 532 532 switch ( $field ) { -
wp-includes/user.php
24 24 */ 25 25 function wp_signon( $credentials = '', $secure_cookie = '' ) { 26 26 if ( empty($credentials) ) { 27 if ( ! empty($_POST['log']) )27 if ( isset($_POST['log']) ) 28 28 $credentials['user_login'] = $_POST['log']; 29 29 if ( ! empty($_POST['pwd']) ) 30 30 $credentials['user_password'] = $_POST['pwd']; 31 31 if ( ! empty($_POST['rememberme']) ) 32 32 $credentials['remember'] = $_POST['rememberme']; 33 33 } 34 35 34 if ( !empty($credentials['remember']) ) 36 35 $credentials['remember'] = true; 37 36 else … … 51 50 add_filter('authenticate', 'wp_authenticate_cookie', 30, 3); 52 51 53 52 $user = wp_authenticate($credentials['user_login'], $credentials['user_password']); 54 55 53 if ( is_wp_error($user) ) { 56 54 if ( $user->get_error_codes() == array('empty_username', 'empty_password') ) { 57 55 $user = new WP_Error('', ''); … … 71 69 add_filter('authenticate', 'wp_authenticate_username_password', 20, 3); 72 70 function wp_authenticate_username_password($user, $username, $password) { 73 71 if ( is_a($user, 'WP_User') ) { return $user; } 74 75 if ( empty($username) || empty($password) ) { 72 if ( !isset($username) || empty($password) ) { 76 73 $error = new WP_Error(); 77 74 78 if ( empty($username) )75 if ( !isset($username) ) 79 76 $error->add('empty_username', __('<strong>ERROR</strong>: The username field is empty.')); 80 77 81 78 if ( empty($password) ) … … 83 80 84 81 return $error; 85 82 } 86 87 83 $user = get_user_by('login', $username); 88 89 84 if ( !$user ) 90 85 return new WP_Error('invalid_username', sprintf(__('<strong>ERROR</strong>: Invalid username. <a href="%s" title="Password Lost and Found">Lost your password</a>?'), wp_lostpassword_url())); 91 86 … … 1032 1027 $_selected = selected( $user->ID, $selected, false ); 1033 1028 if ( $_selected ) 1034 1029 $found_selected = true; 1035 $display = !empty($user->$show) ? $user->$show : '('. $user->user_login . ')';1030 $display = isset($user->$show) && strlen($user->$show) ? $user->$show : '('. $user->user_login . ')'; 1036 1031 $output .= "\t<option value='$user->ID'$_selected>" . esc_html($display) . "</option>\n"; 1037 1032 } 1038 1033 1039 1034 if ( $include_selected && ! $found_selected && ( $selected > 0 ) ) { 1040 1035 $user = get_userdata( $selected ); 1041 1036 $_selected = selected( $user->ID, $selected, false ); 1042 $display = !empty($user->$show) ? $user->$show : '('. $user->user_login . ')';1037 $display = isset($user->$show) && strlen($user->$show) ? $user->$show : '('. $user->user_login . ')'; 1043 1038 $output .= "\t<option value='$user->ID'$_selected>" . esc_html($display) . "</option>\n"; 1044 1039 } 1045 1040 … … 1279 1274 //Remove any non-printable chars from the login string to see if we have ended up with an empty username 1280 1275 $user_login = trim($user_login); 1281 1276 1282 if ( empty($user_login) )1277 if ( !isset($user_login) || !strlen($user_login) ) 1283 1278 return new WP_Error('empty_user_login', __('Cannot create a user with an empty login name.') ); 1284 1279 1285 1280 if ( !$update && username_exists( $user_login ) )
