WordPress.org

Make WordPress Core

Opened 4 years ago

Closed 4 years ago

#38708 closed enhancement (fixed)

Unify email length checks

Reported by: rmccue Owned by: 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 4 years ago.
Basic patch.
38708.2.diff (1.9 KB) - added by rachelbaker 4 years ago.
Adds tests and removes extra handling in rest-api
38708.patch (3.1 KB) - added by desrosj 4 years ago.
38708.2.patch (2.8 KB) - added by sudar 4 years ago.

Download all attachments as: .zip

Change History (16)

#2 @rmccue
4 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.)

#3 @lukecavanagh
4 years ago

@rmccue 

Good to know.

Version 0, edited 4 years ago by lukecavanagh (next)

@lukecavanagh
4 years ago

Basic patch.

#4 @SergeyBiryukov
4 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.


4 years ago

#6 @jbpaul17
4 years ago

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

@rachelbaker
4 years ago

Adds tests and removes extra handling in rest-api

#7 @rachelbaker
4 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
4 years ago

  • Keywords commit added

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


4 years ago

@desrosj
4 years ago

#10 @desrosj
4 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 4 years ago by desrosj (previous) (diff)

@sudar
4 years ago

#11 @sudar
4 years ago

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

#12 @rachelbaker
4 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.