diff --git a/src/wp-includes/ms-functions.php b/src/wp-includes/ms-functions.php
index c878739d6e..1396bc4bff 100644
a
|
b
|
function wpmu_validate_user_signup( $user_name, $user_email ) { |
497 | 497 | |
498 | 498 | $limited_email_domains = get_site_option( 'limited_email_domains' ); |
499 | 499 | if ( is_array( $limited_email_domains ) && ! empty( $limited_email_domains ) ) { |
500 | | $emaildomain = substr( $user_email, 1 + strpos( $user_email, '@' ) ); |
501 | | if ( ! in_array( $emaildomain, $limited_email_domains ) ) { |
| 500 | $allowed_domains = array_map( 'strtolower', $limited_email_domains ); |
| 501 | $emaildomain = strtolower( substr( $user_email, 1 + strpos( $user_email, '@' ) ) ); |
| 502 | if ( ! in_array( $emaildomain, $allowed_domains, true ) ) { |
502 | 503 | $errors->add( 'user_email', __( 'Sorry, that email address is not allowed!' ) ); |
503 | 504 | } |
504 | 505 | } |
diff --git a/tests/phpunit/tests/multisite/wpmuValidateUserSignup.php b/tests/phpunit/tests/multisite/wpmuValidateUserSignup.php
index 6b0bae584e..d9d3e71e2b 100644
a
|
b
|
if ( is_multisite() ) : |
62 | 62 | $this->assertContains( 'user_email', $v['errors']->get_error_codes() ); |
63 | 63 | } |
64 | 64 | |
| 65 | public function test_should_not_fail_for_emails_from_whitelisted_domains_with_mixed_case() { |
| 66 | $domains = array( 'foo.com', 'bar.org' ); |
| 67 | update_site_option( 'limited_email_domains', $domains ); |
| 68 | |
| 69 | $v = wpmu_validate_user_signup( 'foo123', 'foo@BAR.org' ); |
| 70 | $this->assertNotContains( 'user_email', $v['errors']->get_error_codes() ); |
| 71 | } |
| 72 | |
65 | 73 | public function test_should_fail_for_existing_user_name() { |
66 | 74 | $u = self::factory()->user->create( array( 'user_login' => 'foo123' ) ); |
67 | 75 | $v = wpmu_validate_user_signup( 'foo123', 'foo@example.com' ); |