Work at SourceForge, help us to make it a better place! We have an immediate need for a Support Technician in our San Francisco or Denver office.

Close

#310 check_domain in functions.inc.php does not support new gtlds

v2.3.6
closed-fixed
nobody
None
5
2014-02-13
2014-02-13
Markus Hansen
No

check_domain in functions.inc.php checks domain name validity as follows:

if (!preg_match ('/^([-0-9A-Z]+\.)+' . '([0-9A-Z]){2,6}$/i', ($domain)))

Now I got myself a suspiciously shiny new .photography domain, which obviously fails as it is longer than six characters in the tld part. I fixed it for my purpose carefully counting the letters of "photography" to eleven, but this is of course not a general solution:

if (!preg_match ('/^([-0-9A-Z]+\.)+' . '([0-9A-Z]){2,11}$/i', ($domain)))

Discussion

  • Guess why the (old) regex contains {2,6} ;-)
    IIRC it was {2,4} (hint: .info) until things like the .travel domains were "invented"...

    This also means changing the regex to {2,11} is the way to go - we still have the DNS check that ensures that people only enter existing domains.

    Fixed in SVN trunk r1635, 2.3 branch r1636.

    Now let's hope nobody comes up with the idea to setup a ".ihavethelongesttld" TLD ;-)

     
    • status: open --> closed-fixed
     
  • Markus Hansen
    Markus Hansen
    2014-02-13

    I am not sure that .photography is the longest of the new TLDs. There are so many now and upcoming.

     
  • I just checked with my domain provider and you are right - the longest I found is .international with 13 chars :-/

    I seriously doubt people want to type such long domains, but they exist, so the code has to support them.

    Hmmm, I have an idea...
    Old and busted: URL shorteners.
    New hotness: TLD shorteners!
    (... maybe I should register a patent for a TLD shortener? ;-)

    I just changed to code again to allow 13 chars, and will wait for another bugreport that tells me about a new TLD with 30 chars ;-)

    Anyway - trunk r1637, 2.3 branch r1638