Make WordPress Core

Opened 8 years ago

Closed 7 years ago

#38708 closed enhancement (fixed)

Unify email length checks

Reported by: rmccue's profile rmccue Owned by: rachelbaker's profile rachelbaker
Milestone: 4.8 Priority: normal
Severity: normal Version:
Component: Mail Keywords: has-patch has-unit-tests commit
Focuses: rest-api Cc:

Description

Right now, the comment form checks for 6 characters minimum for email addresses. In #38506, we updated the REST API to do the same.

We should update is_email() to include this check, or change the other checks to match is_email(). It makes no real sense to have the check in two places.

Attachments (4)

38708.diff (446 bytes) - added by lukecavanagh 8 years ago.
Basic patch.
38708.2.diff (1.9 KB) - added by rachelbaker 7 years ago.
Adds tests and removes extra handling in rest-api
38708.patch (3.1 KB) - added by desrosj 7 years ago.
38708.2.patch (2.8 KB) - added by sudar 7 years ago.

Download all attachments as: .zip

Change History (16)

#2 @rmccue
8 years ago

@lukecavanagh Yep, specifically this line checking for length > 3 should be changed to > 6.

(Pro-tip: When on GitHub, hit "y" to get a permalink to lines linked to a specific commit, otherwise they can potentially change with future commits.)

@lukecavanagh
8 years ago

Basic patch.

#4 @SergeyBiryukov
8 years ago

  • Component changed from General to Mail
  • Milestone changed from Future Release to 4.8

This ticket was mentioned in Slack in #core by jeffpaul. View the logs.


7 years ago

#6 @jbpaul17
7 years ago

  • Keywords has-patch needs-testing added; 4.8-early needs-patch removed

@rachelbaker
7 years ago

Adds tests and removes extra handling in rest-api

#7 @rachelbaker
7 years ago

  • Keywords has-unit-tests added; needs-testing removed

In 38708.2.diff I added tests and removed the extra string length check and comments from r39158.
Can probably also remove the string length check in wp_handle_comment_submission()

#8 @rachelbaker
7 years ago

  • Keywords commit added

This ticket was mentioned in Slack in #core by jeffpaul. View the logs.


7 years ago

@desrosj
7 years ago

#10 @desrosj
7 years ago

38708.patch removes the length check in wp_handle_comment_submission(). I also noticed a length check in sanitize_email(). Updated that one to 6 for consistency.

Last edited 7 years ago by desrosj (previous) (diff)

@sudar
7 years ago

#11 @sudar
7 years ago

38708.2.patch just removes an unnecessary whitespace change from 38708.patch

#12 @rachelbaker
7 years ago

  • Owner set to rachelbaker
  • Resolution set to fixed
  • Status changed from new to closed

In 40667:

Formatting: Increase minimum characters allowed in is_email() to 6.

Brings the minimum characters expected for a valid email address to six, which matches the expectations in wp_handle_comment_submission() and REST API email arguments.

Props rmccue, lukecavanagh, rachelbaker, desrosj, sudar.
Fixes #38708.

Note: See TracTickets for help on using tickets.