diff --git a/src/wp-includes/user.php b/src/wp-includes/user.php
index 3a11fa10bf..b734801eb0 100644
a
|
b
|
function wp_insert_user( $userdata ) { |
2034 | 2034 | |
2035 | 2035 | $raw_user_url = empty( $userdata['user_url'] ) ? '' : $userdata['user_url']; |
2036 | 2036 | |
| 2037 | /** |
| 2038 | * Check if user url length is <= 100 chars |
| 2039 | * |
| 2040 | * @since 6.0.0 |
| 2041 | * |
| 2042 | * @ticket 44107 |
| 2043 | */ |
| 2044 | if ( mb_strlen( $raw_user_url ) > 100 ) { |
| 2045 | return new WP_Error( 'user_url_too_long', __( 'User URL may not be longer than 100 characters.' ) ); |
| 2046 | } |
| 2047 | |
2037 | 2048 | /** |
2038 | 2049 | * Filters a user's URL before the user is created or updated. |
2039 | 2050 | * |
diff --git a/tests/phpunit/tests/user.php b/tests/phpunit/tests/user.php
index 8c4c0d199e..515d51cf73 100644
a
|
b
|
class Tests_User extends WP_UnitTestCase { |
1000 | 1000 | $this->assertSame( $expected, $user->user_nicename ); |
1001 | 1001 | } |
1002 | 1002 | |
| 1003 | /** |
| 1004 | * @ticket 44107 |
| 1005 | */ |
| 1006 | public function test_wp_insert_user_should_reject_user_url_over_100_characters() { |
| 1007 | $user_url = str_repeat( 'a', 101 ); |
| 1008 | $u = wp_insert_user( |
| 1009 | array( |
| 1010 | 'user_login' => 'test', |
| 1011 | 'user_email' => 'test@example.com', |
| 1012 | 'user_pass' => 'password', |
| 1013 | 'user_url' => $user_url, |
| 1014 | ) |
| 1015 | ); |
| 1016 | |
| 1017 | $this->assertWPError( $u ); |
| 1018 | } |
| 1019 | |
1003 | 1020 | /** |
1004 | 1021 | * @ticket 28004 |
1005 | 1022 | */ |