Ticket #38708: 38708.patch
File 38708.patch, 3.1 KB (added by , 7 years ago) |
---|
-
src/wp-includes/comment.php
3005 3005 * @param int $comment_post_ID Post ID. 3006 3006 */ 3007 3007 do_action( 'comment_on_draft', $comment_post_ID ); 3008 3008 3009 3009 if ( current_user_can( 'read_post', $comment_post_ID ) ) { 3010 3010 return new WP_Error( 'comment_on_draft', __( 'Sorry, comments are not allowed for this item.' ), 403 ); 3011 3011 } else { … … 3065 3065 $comment_type = ''; 3066 3066 3067 3067 if ( get_option( 'require_name_email' ) && ! $user->exists() ) { 3068 if ( 6 > strlen( $comment_author_email )|| '' == $comment_author ) {3068 if ( '' == $comment_author_email || '' == $comment_author ) { 3069 3069 return new WP_Error( 'require_name_email', __( '<strong>ERROR</strong>: please fill the required fields (name, email).' ), 200 ); 3070 3070 } elseif ( ! is_email( $comment_author_email ) ) { 3071 3071 return new WP_Error( 'require_valid_email', __( '<strong>ERROR</strong>: please enter a valid email address.' ), 200 ); -
src/wp-includes/formatting.php
2872 2872 _deprecated_argument( __FUNCTION__, '3.0.0' ); 2873 2873 2874 2874 // Test for the minimum length the email can be 2875 if ( strlen( $email ) < 3) {2875 if ( strlen( $email ) < 6 ) { 2876 2876 /** 2877 2877 * Filters whether an email address is valid. 2878 2878 * … … 3109 3109 */ 3110 3110 function sanitize_email( $email ) { 3111 3111 // Test for the minimum length the email can be 3112 if ( strlen( $email ) < 3) {3112 if ( strlen( $email ) < 6 ) { 3113 3113 /** 3114 3114 * Filters a sanitized email address. 3115 3115 * -
src/wp-includes/rest-api.php
1077 1077 break; 1078 1078 1079 1079 case 'email' : 1080 // is_email() checks for 3 characters (a@b), but 1081 // wp_handle_comment_submission() requires 6 characters (a@b.co) 1082 // 1083 // https://core.trac.wordpress.org/ticket/38506 1084 if ( ! is_email( $value ) || strlen( $value ) < 6 ) { 1080 if ( ! is_email( $value ) ) { 1085 1081 return new WP_Error( 'rest_invalid_email', __( 'Invalid email address.' ) ); 1086 1082 } 1087 1083 break; -
tests/phpunit/tests/formatting/IsEmail.php
9 9 "bob@example.com", 10 10 "phil@example.info", 11 11 "ace@204.32.222.14", 12 "kevin@many.subdomains.make.a.happy.man.edu" 12 "kevin@many.subdomains.make.a.happy.man.edu", 13 "a@b.co", 13 14 ); 14 15 foreach ( $data as $datum ) { 15 16 $this->assertEquals( $datum, is_email( $datum ), $datum ); … … 22 23 'http://bob.example.com/', 23 24 "sif i'd give u it, spamer!1", 24 25 "com.exampleNOSPAMbob", 25 "bob@your mom" 26 "bob@your mom", 27 "a@b.c", 26 28 ); 27 29 foreach ($data as $datum) { 28 30 $this->assertFalse(is_email($datum), $datum);