Fork me on GitHub
Subscribe 5

Ticket #969 (fixed bug)

New TLDs not allowed as valid URLs

  • Created: 2014-05-08 14:16:50
  • Reported by: Franz
  • Assigned to: quy
  • Milestone: 1.5.8
  • Component: code
  • Priority: normal

For things like the website field in user profiles.

Forum topic:


quy 2014-05-09 05:34:52

Here is my solution:
Get the latest tlds from here:
Omit 2 letter tlds since they will be accounted in the regex to reduce list to 384 tlds.
Save to file.
In the url_valid function, include the file and replace the following:



seven 2014-05-09 07:20:58

Accept any TLD.

1) Virtually any TLD is acceptable now (gTLDs).
2) It's not a forum's job to check their existence. Why should it even bother?
3) okay, let's assume we want to be the new userinput nazis. We'd have to fetch the updated TLD list every time the user inserts a new TLD not present in the list, to see if it was accepted in the meantime.
4) It would be better to use DNS resolving then, instead of fetching a big TLD list.

Ref: … -for-gtlds

Franz 2014-05-10 10:50:32

Oh nice, we have to reserve!

Let's just modify the regex to accept any valid-ish URLs without verifying the TLD. That just doesn't make sense these days. Also, anybody can add custom domain names in their hosts file, and something might break in some weird intranet, if we just artificially set a limit.

quy 2014-05-11 00:52:40

Would the max limit be 22 according to the list (xn--clchc0ea0b2g2a9gcd|)?

Franz 2014-05-11 13:36:46

That might change any day.

quy 2014-05-11 15:51:21

Then what would be a reasonable number?

Franz 2014-05-11 21:27:49

Why any number?

quy 2014-05-11 21:50:43

Are you suggesting let it be free form with no validations other than 100 characters for this field as defined in the users table?

Mpok 2014-05-11 23:08:53

As Franz said #3, we can't validate tld.
And thanks to Different55 for signaling the pbm… (note : u tend to forget ur contributors… Should have a clear mention on every ticket, same way as 'Created' ; ok there is the forum link, but still…).

For the pbm : as quy said, it looks awful to "leave up"…
Is there any 'rules' about new TLDs ? (length, caracters, etc…)

quy 2014-07-03 16:30:01

How about changing as follows:

			(?:					   # Explicitly specify top level domains.
			  [A-Za-z]{2})		   # Country codes are exqactly two alpha chars.


			(?:					   # Top level domains
			  [A-Za-z]{2,25}|		   # Country codes are exactly two alpha chars.
			  xn--[0-9A-Za-z]{4,25})		   # Internationalized Domain Name (IDN)

Franz 2014-07-05 09:46:56

Looks fine. Why 25 though?

Studio384 2014-07-05 13:04:10

It should be 63 in theory, as that is the maximum amount of characters in a TLD allowed by DNS.

quy 2014-07-05 13:18:48

Per the current List of Top-Level Domains, the highest length for gTLD is 14 and for IDN is 22 as of today. I arbitrarily selected 25. Lets decide on a number, but keep in mind that there is an 80 characters limit on the Website field per the maxlength attribute.

Comment edited 2 times (Diff, Diff 2)

quy 2014-07-07 13:40:16

Commit f16c7b0 to fluxbb master

#969: Update url_valid to support new TLDs.

Franz 2014-07-08 07:37:14

Commit 0f197d8 to fluxbb master

Merge pull request #112 from Quy/969-gtld

#969: Update url_valid to support new TLDs.

quy 2014-07-08 13:44:13

  • Owner set to quy.
  • Status changed from open to fixed.

Franz 2014-10-20 11:51:29

  • Milestone changed from 1.5.7 to 1.5.8.