Ticket #24618: 24618.2.patch
File 24618.2.patch, 1.2 KB (added by , 10 years ago) |
---|
-
src/wp-includes/user-functions.php
1182 1182 */ 1183 1183 function validate_username( $username ) { 1184 1184 $sanitized = sanitize_user( $username, true ); 1185 $valid = ( $sanitized == $username );1185 $valid = ( $sanitized == $username && ! empty( $sanitized ) ); 1186 1186 /** 1187 1187 * Filter whether the provided username is valid or not. 1188 1188 * -
tests/phpunit/tests/user.php
596 596 if ( ! defined( 'WP_IMPORTING' ) ) { 597 597 $this->assertWPError( $return ); 598 598 } 599 } 600 601 /** 602 * @ticket 24618 603 */ 604 function test_validate_username() { 605 606 $this->assertTrue( validate_username( 'testusername' ) ); 607 $this->assertTrue( validate_username( 'JohnDoe' ) ); 608 $this->assertTrue( validate_username( 'test@test.com' ) ); 609 $this->assertFalse( validate_username( '' ) ); 610 $this->assertFalse( validate_username( '@#&99sd' ) ); 611 612 } 599 613 } 600 614 } 601 615