Index: src/wp-includes/formatting.php
===================================================================
--- src/wp-includes/formatting.php	(revision 31358)
+++ src/wp-includes/formatting.php	(working copy)
@@ -2169,8 +2169,8 @@
 	// Split the domain into subs
 	$subs = explode( '.', $domain );
 
-	// Assume the domain will have at least two subs
-	if ( 2 > count( $subs ) ) {
+	// Assume the domain will have at least two subs, whitelist localhost
+	if ( 2 > count( $subs ) && 'localhost' !== strtolower( $domain ) ) {
 		/** This filter is documented in wp-includes/formatting.php */
 		return apply_filters( 'is_email', false, $email, 'domain_no_periods' );
 	}
@@ -2421,12 +2421,6 @@
 	// Split the domain into subs
 	$subs = explode( '.', $domain );
 
-	// Assume the domain will have at least two subs
-	if ( 2 > count( $subs ) ) {
-		/** This filter is documented in wp-includes/formatting.php */
-		return apply_filters( 'sanitize_email', '', $email, 'domain_no_periods' );
-	}
-
 	// Create an array that will contain valid subs
 	$new_subs = array();
 
@@ -2444,8 +2438,8 @@
 		}
 	}
 
-	// If there aren't 2 or more valid subs
-	if ( 2 > count( $new_subs ) ) {
+	// If there aren't 2 or more valid subs, whitelist localhost
+	if ( 2 > count( $new_subs ) && 'localhost' !== strtolower( $domain ) ) {
 		/** This filter is documented in wp-includes/formatting.php */
 		return apply_filters( 'sanitize_email', '', $email, 'domain_no_valid_subs' );
 	}
Index: tests/phpunit/tests/formatting/IsEmail.php
===================================================================
--- tests/phpunit/tests/formatting/IsEmail.php	(revision 31358)
+++ tests/phpunit/tests/formatting/IsEmail.php	(working copy)
@@ -9,7 +9,8 @@
 			"bob@example.com",
 			"phil@example.info",
 			"ace@204.32.222.14",
-			"kevin@many.subdomains.make.a.happy.man.edu"
+			"kevin@many.subdomains.make.a.happy.man.edu",
+			"sal@localhost",
 			);
 		foreach ( $data as $datum ) {
 			$this->assertEquals( $datum, is_email( $datum ), $datum );
Index: tests/phpunit/tests/formatting/SanitizeEmail.php
===================================================================
--- tests/phpunit/tests/formatting/SanitizeEmail.php	(revision 0)
+++ tests/phpunit/tests/formatting/SanitizeEmail.php	(working copy)
@@ -0,0 +1,19 @@
+<?php
+
+/**
+ * @group formatting
+ */
+class Tests_Formatting_SanitizeEmail extends WP_UnitTestCase {
+	function test_returns_the_unmodified_email_address_if_it_is_valid() {
+		$data = array(
+			"bob@example.com",
+			"phil@example.info",
+			"ace@204.32.222.14",
+			"kevin@many.subdomains.make.a.happy.man.edu",
+			"sal@localhost",
+			);
+		foreach ( $data as $datum ) {
+			$this->assertEquals( $datum, sanitize_email( $datum ), $datum );
+		}
+	}
+}

Property changes on: tests/phpunit/tests/formatting/SanitizeEmail.php
___________________________________________________________________
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property
