WordPress.org

Make WordPress Core

Ticket #27270: email_validation.patch

File email_validation.patch, 963 bytes (added by scruffian, 6 years ago)

Email validation patch

  • wp-includes/formatting.php

     
    19891989                return apply_filters( 'is_email', false, $email, 'local_invalid_chars' );
    19901990        }
    19911991
    1992         // DOMAIN PART
    19931992        // Test for sequences of periods
    1994         if ( preg_match( '/\.{2,}/', $domain ) ) {
     1993        if ( preg_match( '/\.{2,}/', $email ) ) {
    19951994                /** This filter is documented in wp-includes/formatting.php */
    19961995                return apply_filters( 'is_email', false, $email, 'domain_period_sequence' );
    19971996        }
    19981997
    19991998        // Test for leading and trailing periods and whitespace
    2000         if ( trim( $domain, " \t\n\r\0\x0B." ) !== $domain ) {
     1999        if ( trim( $domain, " \t\n\r\0\x0B." ) !== $domain || trim( $local, " \t\n\r\0\x0B." ) !== $local ) {
    20012000                /** This filter is documented in wp-includes/formatting.php */
    20022001                return apply_filters( 'is_email', false, $email, 'domain_period_limits' );
    20032002        }