Simple Machines Community Forum

SMF Development => Bug Reports => Fixed or Bogus Bugs => Topic started by: koubel on October 29, 2015, 11:20:16 AM

Title: SMF doeasn't recognize new domain names and considers these as invalid
Post by: koubel on October 29, 2015, 11:20:16 AM
When anonymous user (who is not logged in) wants to add new topic with email "[email protected]" SMF doesn't allow it and shows warning about invalid email. It's wrong because "[email protected]" is valid email address.

Tested on latest SMF 2.0.11 linux mysql
Title: Re: SMF doeasn't recognize new domain names and considers these as invalid
Post by: Kindred on October 29, 2015, 12:16:34 PM
probably....

the new (and bizarre) TLDs are not supported as valid domains in email addresses...

remember... v2.0 is a few years old at this point and the new TLDs did not exist when it was created.
Title: Re: SMF doeasn't recognize new domain names and considers these as invalid
Post by: margarett on October 29, 2015, 12:54:25 PM
The fix is quite easy, though...

In Subs-Members.php, you find this:
// !!! Separate the sprintf?
if (empty($regOptions['email']) || preg_match('~^[0-9A-Za-z=_+\-/][0-9A-Za-z=_\'+\-/\.]*@[\w\-]+(\.[\w\-]+)*(\.[\w]{2,6})$~', $regOptions['email']) === 0 || strlen($regOptions['email']) > 255)
$reg_errors[] = array('lang', 'profile_error_bad_email');


This bit here
{2,6}
States that the .something must be between 2 and 6 characters (after the dot) long. ."systems" is *7* characters long :P
So you can change the upper limit to a more pleasant value to you ;)
Title: Re: SMF doeasn't recognize new domain names and considers these as invalid
Post by: vbgamer45 on October 29, 2015, 01:01:16 PM
Yeah I would recommend changing the {2,6} to something higher maybe 10
Title: Re: SMF doeasn't recognize new domain names and considers these as invalid
Post by: Oldiesmann on October 30, 2015, 12:51:27 PM
Looking at the list on Wikipedia, the longest non-international TLD at the moment is ".cancerresearch", which is 15 characters. Most seem to be 12 or fewer characters though.
Title: Re: SMF doeasn't recognize new domain names and considers these as invalid
Post by: koubel on February 24, 2016, 08:55:10 AM
So thank you guys (better late than never).