Make WordPress Core

Opened 15 years ago

Closed 11 years ago

#15409 closed enhancement (wontfix)

Top-Level Domain (TLD) validation function and email validation/sanitization

Reported by: stephdau's profile stephdau Owned by: stephdau's profile stephdau
Milestone: Priority: normal
Severity: normal Version: 3.1
Component: Formatting Keywords: has-patch
Focuses: Cc:

Description

The following patch proposes a new global function, does_value_end_in_valid_tld, to allow for a string value to be tested for as ending in a valid TLD.

TLD list as per http://data.iana.org/TLD/tlds-alpha-by-domain.txt

Regex inspired by http://gitorious.org/statusnet/mainline/blobs/master/lib/util.php#line724

The patch also implements using does_value_end_in_valid_tld() in is_email() and sanitize_email(), to start with.

Attachments (1)

15409.diff (2.7 KB) - added by stephdau 15 years ago.

Download all attachments as: .zip

Change History (14)

#1 @stephdau
15 years ago

  • Owner set to stephdau
  • Status changed from new to accepted

#2 @scribu
15 years ago

How about naming it ends_with_valid_tld() instead? It's shorter.

#3 @scribu
15 years ago

Also, ICANN recently announced that TLDs will be a lot easier to register so I'm not sure if this function is a good idea anymore.

#4 @stephdau
15 years ago

ends_with_valid_tld(): sure, why not

TLD: Ideally, I'd say we should have the function, and once the TLDs are easier to register, find a way to make it dynamic by accessing some kind of API (or at least let people do via plugin with a hook). regardless, the existing list won;t become obsolete when they do.

#5 @stephdau
15 years ago

Plus, you know ICANN: "soon" is a relative term, W3C-style. ;)

@stephdau
15 years ago

#6 @stephdau
15 years ago

Revised the patch with new suggested name: ends_with_valid_tld()

#8 in reply to: ↑ 7 @stephdau
15 years ago

Replying to scribu:

Found the place where I read that:
http://arstechnica.com/web/news/2010/11/icann-to-open-top-level-domain-floodgates.ars

Oh cool, thanks for the ref! Okay, it does seem to be happening faster than I thought, but I guess we still have until 2012:

ICANN plans to release its guidebook for more public comments on Nov. 9, and to
approve it at its next board meeting in Colombia in the first half of December. If
all goes smoothly, they will begin accepting applications in May 2011 for new
TLDs that would start functioning sometime in 2012. ICANN has said they will
draw the line at 1,000 new TLDs per year.

FTR: this TLD check implementation was implemented on WordPress.com for signup and such, as a response to users mistyping their email addresses and being left in the dark. TLD validation was the sanest route for us.

#9 @mrmist
15 years ago

  • Keywords has-patch added

#10 @nacin
15 years ago

  • Milestone changed from Awaiting Review to Future Release

Not sure about this, due to the pending changes. Would rather just make sure a hook is in place.

#11 @stephdau
15 years ago

Hook: agreed, definitely a good way to go.

#12 follow-up: @nacin
15 years ago

So can this be entirely latched on to the various is_email hooks in is_email()?

#13 in reply to: ↑ 12 @nacin
11 years ago

  • Milestone Future Release deleted
  • Resolution set to wontfix
  • Status changed from accepted to closed

Replying to nacin:

So can this be entirely latched on to the various is_email hooks in is_email()?

Seems like yes. The generic 'is_email' filter would work. And yeah, now that we have arbitrary TLDs coming, this is not gonna happen.

Note: See TracTickets for help on using tickets.