mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-08-12 12:50:28 +00:00
Users: Empty sanitized usernames should be considered invalid when passed through validate_username().
Adds tests. Props gwinhlopez for the initial patch. Props mordauk, chriscct7. Fixes #24618. git-svn-id: https://develop.svn.wordpress.org/trunk@34856 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
@@ -1176,13 +1176,15 @@ function email_exists( $email ) {
|
||||
* Checks whether a username is valid.
|
||||
*
|
||||
* @since 2.0.1
|
||||
* @since 4.4.0 Empty sanitized usernames are now considered invalid
|
||||
*
|
||||
* @param string $username Username.
|
||||
* @return bool Whether username given is valid
|
||||
*/
|
||||
function validate_username( $username ) {
|
||||
$sanitized = sanitize_user( $username, true );
|
||||
$valid = ( $sanitized == $username );
|
||||
$valid = ( $sanitized == $username && ! empty( $sanitized ) );
|
||||
|
||||
/**
|
||||
* Filter whether the provided username is valid or not.
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user