Ticket #27270: 27270.patch
File 27270.patch, 1.8 KB (added by , 10 years ago) |
---|
-
src/wp-includes/formatting.php
2146 2146 return apply_filters( 'is_email', false, $email, 'local_invalid_chars' ); 2147 2147 } 2148 2148 2149 // DOMAIN PART 2150 // Test for sequences of periods 2151 if ( preg_match( '/\.{2,}/', $domain ) ) { 2149 // Test for sequences of periods in either the local part or domain part 2150 if ( preg_match( '/\.{2,}/', $email) ) { 2152 2151 /** This filter is documented in wp-includes/formatting.php */ 2153 2152 return apply_filters( 'is_email', false, $email, 'domain_period_sequence' ); 2154 2153 } 2155 2154 2156 // Test for leading and trailing periods and whitespace 2157 if ( trim( $domain, " \t\n\r\0\x0B." ) !== $domain ) {2155 // Test for leading and trailing periods and whitespace in both local and domain parts 2156 if ( trim( $domain, " \t\n\r\0\x0B." ) !== $domain || trim( $local, " \t\n\r\0\x0B." ) !== $local ) { 2158 2157 /** This filter is documented in wp-includes/formatting.php */ 2159 2158 return apply_filters( 'is_email', false, $email, 'domain_period_limits' ); 2160 2159 } 2161 2160 2161 // DOMAIN PART 2162 2162 2163 // Split the domain into subs 2163 2164 $subs = explode( '.', $domain ); 2164 2165 -
tests/phpunit/tests/formatting/IsEmail.php
22 22 'http://bob.example.com/', 23 23 "sif i'd give u it, spamer!1", 24 24 "com.exampleNOSPAMbob", 25 "bob@your mom" 25 "bob@your mom", 26 ".bad.@example.com", 27 "two..periods@example.com" 26 28 ); 27 29 foreach ($data as $datum) { 28 30 $this->assertFalse(is_email($datum), $datum);