View Issue Details

This bug affects 1 person(s).
 12
IDProjectCategoryView StatusLast Update
03901Bug reportsSurvey editingpublic2010-02-04 18:40
Reporteruser5628Assigned Toharsha  
PrioritynormalSeverityminor 
Status closedResolutionfixed 
Product Version1.86 
Fixed in Version1.87+ 
Summary03901: validate_email too restrictive
Description

validate_email function on common.php are so much restrictive and not respect RFCs

http://en.wikipedia.org/wiki/E-mail_address

Exemple : validate_email do not accept "plus" on address :

"me+test@exemple.tld"

Sorry for my bad english !

TagsNo tags attached.
Attached Files
emailvalidation.patch (7,433 bytes)   
Index: common.php
===================================================================
--- common.php	(revision 8273)
+++ common.php	(working copy)
@@ -2174,7 +2174,7 @@
 	}
 }
 
-function validate_email($email)
+/*function validate_email($email)
 {
 	// Create the syntactical validation regular expression
 	// Validate the syntax
@@ -2182,8 +2182,201 @@
 	// see http://data.iana.org/TLD/tlds-alpha-by-domain.txt
 	$maxrootdomainlength = 6;
     return ( ! preg_match("/^[_a-zA-Z0-9-]+(\.[_a-zA-Z0-9-]+)*@[a-zA-Z0-9-]+(\.[a-zA-Z0-9-]+)*\.(([0-9]{1,3})|([a-zA-Z]{2,".$maxrootdomainlength."}))$/ix", $email)) ? FALSE : TRUE;  
+}*/
+
+
+function validate_email($email)
+{
+
+
+	$no_ws_ctl    = "[\\x01-\\x08\\x0b\\x0c\\x0e-\\x1f\\x7f]";
+	$alpha        = "[\\x41-\\x5a\\x61-\\x7a]";
+	$digit        = "[\\x30-\\x39]";
+	$cr        = "\\x0d";
+	$lf        = "\\x0a";
+	$crlf        = "(?:$cr$lf)";
+
+	$obs_char    = "[\\x00-\\x09\\x0b\\x0c\\x0e-\\x7f]";
+	$obs_text    = "(?:$lf*$cr*(?:$obs_char$lf*$cr*)*)";
+	$text        = "(?:[\\x01-\\x09\\x0b\\x0c\\x0e-\\x7f]|$obs_text)";
+
+	$text        = "(?:$lf*$cr*$obs_char$lf*$cr*)";
+	$obs_qp        = "(?:\\x5c[\\x00-\\x7f])";
+	$quoted_pair    = "(?:\\x5c$text|$obs_qp)";
+
+	$wsp        = "[\\x20\\x09]";
+	$obs_fws    = "(?:$wsp+(?:$crlf$wsp+)*)";
+	$fws        = "(?:(?:(?:$wsp*$crlf)?$wsp+)|$obs_fws)";
+	$ctext        = "(?:$no_ws_ctl|[\\x21-\\x27\\x2A-\\x5b\\x5d-\\x7e])";
+	$ccontent    = "(?:$ctext|$quoted_pair)";
+	$comment    = "(?:\\x28(?:$fws?$ccontent)*$fws?\\x29)";
+	$cfws        = "(?:(?:$fws?$comment)*(?:$fws?$comment|$fws))";
+
+	$outer_ccontent_dull    = "(?:$fws?$ctext|$quoted_pair)";
+	$outer_ccontent_nest    = "(?:$fws?$comment)";
+	$outer_comment        = "(?:\\x28$outer_ccontent_dull*(?:$outer_ccontent_nest$outer_ccontent_dull*)+$fws?\\x29)";
+
+	$atext        = "(?:$alpha|$digit|[\\x21\\x23-\\x27\\x2a\\x2b\\x2d\\x2f\\x3d\\x3f\\x5e\\x5f\\x60\\x7b-\\x7e])";
+	$atom        = "(?:$cfws?(?:$atext)+$cfws?)";
+
+	$qtext        = "(?:$no_ws_ctl|[\\x21\\x23-\\x5b\\x5d-\\x7e])";
+	$qcontent    = "(?:$qtext|$quoted_pair)";
+	$quoted_string    = "(?:$cfws?\\x22(?:$fws?$qcontent)*$fws?\\x22$cfws?)";
+
+	$quoted_string    = "(?:$cfws?\\x22(?:$fws?$qcontent)+$fws?\\x22$cfws?)";
+	$word        = "(?:$atom|$quoted_string)";
+
+	$obs_local_part    = "(?:$word(?:\\x2e$word)*)";
+	$obs_domain    = "(?:$atom(?:\\x2e$atom)*)";
+
+	$dot_atom_text    = "(?:$atext+(?:\\x2e$atext+)*)";
+	$dot_atom    = "(?:$cfws?$dot_atom_text$cfws?)";
+
+	$dtext        = "(?:$no_ws_ctl|[\\x21-\\x5a\\x5e-\\x7e])";
+	$dcontent    = "(?:$dtext|$quoted_pair)";
+	$domain_literal    = "(?:$cfws?\\x5b(?:$fws?$dcontent)*$fws?\\x5d$cfws?)";
+	
+	// local-part      =       dot-atom / quoted-string / obs-local-part
+	// domain          =       dot-atom / domain-literal / obs-domain
+	// addr-spec       =       local-part "@" domain
+
+	$local_part    = "(($dot_atom)|($quoted_string)|($obs_local_part))";
+	$domain        = "(($dot_atom)|($domain_literal)|($obs_domain))";
+	$addr_spec    = "$local_part\\x40$domain";
+
+	if (strlen($email) > 256) return FALSE;
+
+	$email = rfc3696_strip_comments($outer_comment, $email, "(x)");
+
+	if (!preg_match("!^$addr_spec$!", $email, $m))
+	{
+
+		return FALSE;
+	}
+
+	$bits = array(
+            'local'            => isset($m[1]) ? $m[1] : '',
+            'local-atom'        => isset($m[2]) ? $m[2] : '',
+            'local-quoted'        => isset($m[3]) ? $m[3] : '',
+            'local-obs'        => isset($m[4]) ? $m[4] : '',
+            'domain'        => isset($m[5]) ? $m[5] : '',
+            'domain-atom'        => isset($m[6]) ? $m[6] : '',
+            'domain-literal'    => isset($m[7]) ? $m[7] : '',
+            'domain-obs'        => isset($m[8]) ? $m[8] : '',
+	);
+
+
+	$bits['local']    = rfc3696_strip_comments($comment, $bits['local']);
+	$bits['domain']    = rfc3696_strip_comments($comment, $bits['domain']);
+
+	// length limits on segments
+	if (strlen($bits['local']) > 64) return FALSE;
+	if (strlen($bits['domain']) > 255) return FALSE;
+
+
+	
+	// restrictuions on domain-literals from RFC2821 section 4.1.3
+
+	if (strlen($bits['domain-literal'])){
+
+		$Snum            = "(\d{1,3})";
+		$IPv4_address_literal    = "$Snum\.$Snum\.$Snum\.$Snum";
+
+		$IPv6_hex        = "(?:[0-9a-fA-F]{1,4})";
+
+		$IPv6_full        = "IPv6\:$IPv6_hex(:?\:$IPv6_hex){7}";
+
+		$IPv6_comp_part        = "(?:$IPv6_hex(?:\:$IPv6_hex){0,5})?";
+		$IPv6_comp        = "IPv6\:($IPv6_comp_part\:\:$IPv6_comp_part)";
+
+		$IPv6v4_full        = "IPv6\:$IPv6_hex(?:\:$IPv6_hex){5}\:$IPv4_address_literal";
+
+		$IPv6v4_comp_part    = "$IPv6_hex(?:\:$IPv6_hex){0,3}";
+		$IPv6v4_comp        = "IPv6\:((?:$IPv6v4_comp_part)?\:\:(?:$IPv6v4_comp_part\:)?)$IPv4_address_literal";
+
+
+		#
+		# IPv4 is simple
+		#
+
+		if (preg_match("!^\[$IPv4_address_literal\]$!", $bits['domain'], $m)){
+
+			if (intval($m[1]) > 255) return FALSE;
+			if (intval($m[2]) > 255) return FALSE;
+			if (intval($m[3]) > 255) return FALSE;
+			if (intval($m[4]) > 255) return FALSE;
+
+		}else{
+
+			#
+			# this should be IPv6 - a bunch of tests are needed here :)
+			#
+
+			while (1){
+
+				if (preg_match("!^\[$IPv6_full\]$!", $bits['domain'])){
+					break;
+				}
+
+				if (preg_match("!^\[$IPv6_comp\]$!", $bits['domain'], $m)){
+					list($a, $b) = explode('::', $m[1]);
+					$folded = (strlen($a) && strlen($b)) ? "$a:$b" : "$a$b";
+					$groups = explode(':', $folded);
+					if (count($groups) > 6) return FALSE;
+					break;
+				}
+
+				if (preg_match("!^\[$IPv6v4_full\]$!", $bits['domain'], $m)){
+
+					if (intval($m[1]) > 255) return FALSE;
+					if (intval($m[2]) > 255) return FALSE;
+					if (intval($m[3]) > 255) return FALSE;
+					if (intval($m[4]) > 255) return FALSE;
+					break;
+				}
+
+				if (preg_match("!^\[$IPv6v4_comp\]$!", $bits['domain'], $m)){
+					list($a, $b) = explode('::', $m[1]);
+					$b = substr($b, 0, -1); # remove the trailing colon before the IPv4 address
+					$folded = (strlen($a) && strlen($b)) ? "$a:$b" : "$a$b";
+					$groups = explode(':', $folded);
+					if (count($groups) > 4) return FALSE;
+					break;
+				}
+
+				return FALSE;
+			}
+		}
+	}else{
+
+		$labels = explode('.', $bits['domain']);
+		if (count($labels) == 1) return FALSE;
+		foreach ($labels as $label){
+
+			if (strlen($label) > 63) return FALSE;
+			if (substr($label, 0, 1) == '-') return FALSE;
+			if (substr($label, -1) == '-') return FALSE;
+		}
+
+		if (preg_match('!^[0-9]+$!', array_pop($labels))) return FALSE;
+	}
+
+
+	return TRUE;
 }
 
+
+function rfc3696_strip_comments($comment, $email, $replace='')
+{
+
+	while (1){
+		$new = preg_replace("!$comment!", $replace, $email);
+		if (strlen($new) == strlen($email)){
+			return $email;
+		}
+		$email = $new;
+	}
+}
 function validate_templatedir($templatename)
 {
     global $publicdir, $defaulttemplate;
Index: classes/core/sanitize.php
===================================================================
--- classes/core/sanitize.php	(revision 8273)
+++ classes/core/sanitize.php	(working copy)
@@ -163,7 +163,7 @@
     $emailarray=explode(';',$email);
     for ($i = 0; $i <= count($emailarray)-1; $i++)
     {
-      $emailarray[$i]=preg_replace('/[^a-zA-Z0-9;+_.@-]/i', '', $emailarray[$i]);
+      $emailarray[$i]=preg_replace('/[^a-zA-Z0-9;+_=|.$%&#!{*~`?}^@-]/i', '', $emailarray[$i]);
     }
     return implode(';',$emailarray);
 }
emailvalidation.patch (7,433 bytes)   
email-validator.patch (7,409 bytes)   
Index: common.php
===================================================================
--- common.php	(revision 8325)
+++ common.php	(working copy)
@@ -2175,7 +2175,7 @@
 	}
 }
 
-function validate_email($email)
+/*function validate_email($email)
 {
 	// Create the syntactical validation regular expression
 	// Validate the syntax
@@ -2183,8 +2183,220 @@
 	// see http://data.iana.org/TLD/tlds-alpha-by-domain.txt
 	$maxrootdomainlength = 6;
     return ( ! preg_match("/^[_a-zA-Z0-9-]+(\.[_a-zA-Z0-9-]+)*@[a-zA-Z0-9-]+(\.[a-zA-Z0-9-]+)*\.(([0-9]{1,3})|([a-zA-Z]{2,".$maxrootdomainlength."}))$/ix", $email)) ? FALSE : TRUE;  
+}*/
+
+function validate_email($email){
+
+
+	$no_ws_ctl    = "[\\x01-\\x08\\x0b\\x0c\\x0e-\\x1f\\x7f]";
+	$alpha        = "[\\x41-\\x5a\\x61-\\x7a]";
+	$digit        = "[\\x30-\\x39]";
+	$cr        = "\\x0d";
+	$lf        = "\\x0a";
+	$crlf        = "(?:$cr$lf)";
+
+
+	$obs_char    = "[\\x00-\\x09\\x0b\\x0c\\x0e-\\x7f]";
+	$obs_text    = "(?:$lf*$cr*(?:$obs_char$lf*$cr*)*)";
+	$text        = "(?:[\\x01-\\x09\\x0b\\x0c\\x0e-\\x7f]|$obs_text)";
+
+
+	$text        = "(?:$lf*$cr*$obs_char$lf*$cr*)";
+	$obs_qp        = "(?:\\x5c[\\x00-\\x7f])";
+	$quoted_pair    = "(?:\\x5c$text|$obs_qp)";
+
+
+	$wsp        = "[\\x20\\x09]";
+	$obs_fws    = "(?:$wsp+(?:$crlf$wsp+)*)";
+	$fws        = "(?:(?:(?:$wsp*$crlf)?$wsp+)|$obs_fws)";
+	$ctext        = "(?:$no_ws_ctl|[\\x21-\\x27\\x2A-\\x5b\\x5d-\\x7e])";
+	$ccontent    = "(?:$ctext|$quoted_pair)";
+	$comment    = "(?:\\x28(?:$fws?$ccontent)*$fws?\\x29)";
+	$cfws        = "(?:(?:$fws?$comment)*(?:$fws?$comment|$fws))";
+
+
+	$outer_ccontent_dull    = "(?:$fws?$ctext|$quoted_pair)";
+	$outer_ccontent_nest    = "(?:$fws?$comment)";
+	$outer_comment        = "(?:\\x28$outer_ccontent_dull*(?:$outer_ccontent_nest$outer_ccontent_dull*)+$fws?\\x29)";
+
+
+
+	$atext        = "(?:$alpha|$digit|[\\x21\\x23-\\x27\\x2a\\x2b\\x2d\\x2f\\x3d\\x3f\\x5e\\x5f\\x60\\x7b-\\x7e])";
+	$atext_domain     = "(?:$alpha|$digit)";
+
+	$atom        = "(?:$cfws?(?:$atext)+$cfws?)";
+	$atom_domain       = "(?:$cfws?(?:$atext_domain)+$cfws?)";
+
+
+	$qtext        = "(?:$no_ws_ctl|[\\x21\\x23-\\x5b\\x5d-\\x7e])";
+	$qcontent    = "(?:$qtext|$quoted_pair)";
+	$quoted_string    = "(?:$cfws?\\x22(?:$fws?$qcontent)*$fws?\\x22$cfws?)";
+
+
+	$quoted_string    = "(?:$cfws?\\x22(?:$fws?$qcontent)+$fws?\\x22$cfws?)";
+	$word        = "(?:$atom|$quoted_string)";
+
+
+	$obs_local_part    = "(?:$word(?:\\x2e$word)*)";
+
+
+	$obs_domain    = "(?:$atom_domain(?:\\x2e$atom_domain)*)";
+
+	$dot_atom_text     = "(?:$atext+(?:\\x2e$atext+)*)";
+	$dot_atom_text_domain    = "(?:$atext_domain+(?:\\x2e$atext_domain+)*)";
+
+
+	$dot_atom    	   = "(?:$cfws?$dot_atom_text$cfws?)";
+	$dot_atom_domain   = "(?:$cfws?$dot_atom_text_domain$cfws?)";
+
+
+	$dtext        = "(?:$no_ws_ctl|[\\x21-\\x5a\\x5e-\\x7e])";
+	$dcontent    = "(?:$dtext|$quoted_pair)";
+	$domain_literal    = "(?:$cfws?\\x5b(?:$fws?$dcontent)*$fws?\\x5d$cfws?)";
+
+
+	$local_part    = "(($dot_atom)|($quoted_string)|($obs_local_part))";
+	$domain        = "(($dot_atom_domain)|($domain_literal)|($obs_domain))";
+	$addr_spec    = "$local_part\\x40$domain";
+
+
+	if (strlen($email) > 256) return FALSE;
+
+
+	$email = strip_comments($outer_comment, $email, "(x)");
+
+
+
+	if (!preg_match("!^$addr_spec$!", $email, $m)){
+
+		return FALSE;
+	}
+
+	$bits = array(
+            'local'            => isset($m[1]) ? $m[1] : '',
+            'local-atom'        => isset($m[2]) ? $m[2] : '',
+            'local-quoted'        => isset($m[3]) ? $m[3] : '',
+            'local-obs'        => isset($m[4]) ? $m[4] : '',
+            'domain'        => isset($m[5]) ? $m[5] : '',
+            'domain-atom'        => isset($m[6]) ? $m[6] : '',
+            'domain-literal'    => isset($m[7]) ? $m[7] : '',
+            'domain-obs'        => isset($m[8]) ? $m[8] : '',
+	);
+
+
+
+	$bits['local']    = strip_comments($comment, $bits['local']);
+	$bits['domain']    = strip_comments($comment, $bits['domain']);
+
+
+
+
+	if (strlen($bits['local']) > 64) return FALSE;
+	if (strlen($bits['domain']) > 255) return FALSE;
+
+
+
+	if (strlen($bits['domain-literal'])){
+
+		$Snum            = "(\d{1,3})";
+		$IPv4_address_literal    = "$Snum\.$Snum\.$Snum\.$Snum";
+
+		$IPv6_hex        = "(?:[0-9a-fA-F]{1,4})";
+
+		$IPv6_full        = "IPv6\:$IPv6_hex(:?\:$IPv6_hex){7}";
+
+		$IPv6_comp_part        = "(?:$IPv6_hex(?:\:$IPv6_hex){0,5})?";
+		$IPv6_comp        = "IPv6\:($IPv6_comp_part\:\:$IPv6_comp_part)";
+
+		$IPv6v4_full        = "IPv6\:$IPv6_hex(?:\:$IPv6_hex){5}\:$IPv4_address_literal";
+
+		$IPv6v4_comp_part    = "$IPv6_hex(?:\:$IPv6_hex){0,3}";
+		$IPv6v4_comp        = "IPv6\:((?:$IPv6v4_comp_part)?\:\:(?:$IPv6v4_comp_part\:)?)$IPv4_address_literal";
+
+
+
+		if (preg_match("!^\[$IPv4_address_literal\]$!", $bits['domain'], $m)){
+
+			if (intval($m[1]) > 255) return FALSE;
+			if (intval($m[2]) > 255) return FALSE;
+			if (intval($m[3]) > 255) return FALSE;
+			if (intval($m[4]) > 255) return FALSE;
+
+		}else{
+
+
+			while (1){
+
+				if (preg_match("!^\[$IPv6_full\]$!", $bits['domain'])){
+					break;
+				}
+
+				if (preg_match("!^\[$IPv6_comp\]$!", $bits['domain'], $m)){
+					list($a, $b) = explode('::', $m[1]);
+					$folded = (strlen($a) && strlen($b)) ? "$a:$b" : "$a$b";
+					$groups = explode(':', $folded);
+					if (count($groups) > 6) return FALSE;
+					break;
+				}
+
+				if (preg_match("!^\[$IPv6v4_full\]$!", $bits['domain'], $m)){
+
+					if (intval($m[1]) > 255) return FALSE;
+					if (intval($m[2]) > 255) return FALSE;
+					if (intval($m[3]) > 255) return FALSE;
+					if (intval($m[4]) > 255) return FALSE;
+					break;
+				}
+
+				if (preg_match("!^\[$IPv6v4_comp\]$!", $bits['domain'], $m)){
+					list($a, $b) = explode('::', $m[1]);
+					$b = substr($b, 0, -1); # remove the trailing colon before the IPv4 address
+					$folded = (strlen($a) && strlen($b)) ? "$a:$b" : "$a$b";
+					$groups = explode(':', $folded);
+					if (count($groups) > 4) return FALSE;
+					break;
+				}
+
+				return FALSE;
+			}
+		}
+	}else{
+
+
+		$labels = explode('.', $bits['domain']);
+
+
+		if (count($labels) == 1) return FALSE;
+
+
+		foreach ($labels as $label){
+
+			if (strlen($label) > 63) return FALSE;
+			if (substr($label, 0, 1) == '-') return FALSE;
+			if (substr($label, -1) == '-') return FALSE;
+		}
+
+		if (preg_match('!^[0-9]+$!', array_pop($labels))) return FALSE;
+	}
+
+
+	return TRUE;
 }
 
+##################################################################################
+
+function strip_comments($comment, $email, $replace=''){
+
+	while (1){
+		$new = preg_replace("!$comment!", $replace, $email);
+		if (strlen($new) == strlen($email)){
+			return $email;
+		}
+		$email = $new;
+	}
+}
+
+
 function validate_templatedir($templatename)
 {
     global $publicdir, $defaulttemplate;
Index: classes/core/sanitize.php
===================================================================
--- classes/core/sanitize.php	(revision 8325)
+++ classes/core/sanitize.php	(working copy)
@@ -163,7 +163,7 @@
     $emailarray=explode(';',$email);
     for ($i = 0; $i <= count($emailarray)-1; $i++)
     {
-      $emailarray[$i]=preg_replace('/[^a-zA-Z0-9;+_.@-]/i', '', $emailarray[$i]);
+      $emailarray[$i]=preg_replace('/[^a-zA-Z0-9;+_=|.$%&#!{*~`?}^@-]/i', '', $emailarray[$i]);
     }
     return implode(';',$emailarray);
 }
email-validator.patch (7,409 bytes)   
Bug heat12
Complete LimeSurvey version number (& build)7697
I will donate to the project if issue is resolved
BrowserFirefox 3.5
Database type & versionMysql 5
Server OS (if known)GNU/Linux
Webserver software & version (if known)Apache
PHP Version5.2.10

Relationships

related to 04048 closedharsha + (plus) character in email not allowed when importing tokens 

Users monitoring this issue

There are no users monitoring this issue.

Activities

user372

2009-11-25 18:06

  ~10257

@ c_schmitz: do we or do we want to support these email-addresses?

c_schmitz

c_schmitz

2009-11-26 00:03

administrator   ~10261

It is a valid email address :-).
I think Tim (rakete) is the right person for this issue because I think he created the latest regexp to check the email address validity.

rakete

rakete

2009-11-26 13:45

reporter   ~10274

Last edited: 2009-11-26 13:49

no, I did not created the last one, I just pointed out that valid chars are not allowed with our regex...

It is not only the + char, some other valid chars are not recognized as valid, too.

Especially these signs are totally valid E-Mail Address chars (for the local part), but not ok for Limesurvey:

! # $ % & ' * + / = ? ^ ` { | } ~

Question should be: Do we want to be Standard Conform to RFC5322 or do we want to be Hotmail, only allowing E-mails with [a-Z][0-9]._-

We discussed that a while ago and decided to keep the regex, due to security concerns, when allowing other ASCI Chars than ._- in E-mail adresses.

After that said:

How much do we want know? Discussion was old, we are on PHP5 only now and I could use filter_var. But this function must have at least PHP 5.2

Some Ressource: (sorry for using this as my notepad :))
http://de.php.net/manual/en/function.filter-var.php
http://svn.php.net/viewvc/php/php-src/trunk/ext/filter/logical_filters.c

c_schmitz

c_schmitz

2009-11-26 19:09

administrator   ~10282

17:13] c_schmitz: rakete: Well the question is if we should soften it up completely or only allow + signs additionally
[17:15] c_schmitz: lets try out your RFC5322 solution, but please make sure that on DB insertion and display of the email address it is quoted accordingly

user5628

2009-11-27 09:50

  ~10284

Hello,

Thanks to your interest about this.

@rakete : I tried to send email me+test@exemple.tld to hotmail account and that's OK !

Be careful about filter_var : lot's of server use RedHat Entreprise 5 => php 5.1.3

Bye,
Yves

c_schmitz

c_schmitz

2009-11-27 10:26

administrator   ~10285

Yes, I agree - the solution should be 5.x compatible, not only 5.2

rakete

rakete

2009-11-27 11:04

reporter   ~10286

@yveslime: Maybe I read some old information about Hotmail not allowing all valid chars... I guess I found that in wikipedia (shame on me)

I will take a deeper look on how others implemented it and what is state of the Art in E-Mail validation today.

by now I think we need 2 Regex. One for the local, one for the domain Part.

Hopefully I have some time on this Weekend for this... You'll read me..

user5703

2009-12-01 15:29

  ~10390

Hi,

I have the same problem. I replaced the validate_email function with the function from http://code.iamcal.com/php/rfc822/ (RFC 3696 Parser). It works good for me. Maybe you can use this function?

rakete

rakete

2009-12-15 11:03

reporter   ~10576

hmm... that is indeed nice, but I need a day to understand and check the Regexes...
Can we maybe just trust them? :D
I really do not want to check deep into them as my head had enough to do the last days...

harsha

harsha

2010-01-17 10:53

reporter   ~10803

patch is attached for + validations in email address.

I happened to know Gmail also uses only letters (a-z), numbers (0-9), and periods (.)

harsha

harsha

2010-01-17 19:38

reporter   ~10805

Now doing according to the standard RFC5322.It is working fine for almost all of the characters (! # $ % & ' * + / = ? ^ ` { | } ~) , have to check it with their updated source code.

rakete

rakete

2010-01-20 09:55

reporter   ~10814

I know I should have done this already, but my sparetime was not much the last month..

I just want to make sure, you are aware of the fact, that local and domain part of an email-address have different spezifications in allowed characters.

So the check should split the mailadress in two party and check both parts seperatly.

Otherwise rakete@#?.!!! could get an valid email-address, but it is not...

harsha

harsha

2010-01-27 04:59

reporter   ~10908

Yes i am aware of that, but i followed the latest RFC5322 standard.it does allow that and i did not find anything that domain should not allow those characters. Thanks for reminding anyway.I want to make sure should i change that logic for not allowing those characters in domain part even though it is supported by RFC5322 .

c_schmitz

c_schmitz

2010-01-27 22:58

administrator   ~10910

I think rakete is right.
A good read on the subject is also
http://www.linuxjournal.com/article/9585

harsha

harsha

2010-01-28 20:59

reporter   ~10926

It seems really helpful. Thanks Carsten. I will have a look.

harsha

harsha

2010-01-29 22:00

reporter   ~10936

I modified RFC5322 parser for not allowing #?.!%^&!!etc in domain part. patch is attached. please have a look and verify it.

Thanks

harsha

harsha

2010-01-31 14:38

reporter   ~10943

Fixed email validation issue.

Issue History

Date Modified Username Field Change
2009-11-25 15:33 user5628 New Issue
2009-11-25 15:33 user5628 Status new => assigned
2009-11-25 15:33 user5628 Assigned To => user372
2009-11-25 15:33 user5628 LimeSurvey build number => 7697
2009-11-25 15:33 user5628 Browser => Firefox 3.5
2009-11-25 15:33 user5628 Database & DB-Version => Mysql 5
2009-11-25 15:33 user5628 Operating System (Server) => GNU/Linux
2009-11-25 15:33 user5628 Webserver => Apache
2009-11-25 15:33 user5628 PHP Version => 5.2.10
2009-11-25 18:06 user372 Note Added: 10257
2009-11-25 18:06 user372 Assigned To user372 => c_schmitz
2009-11-26 00:03 c_schmitz Note Added: 10261
2009-11-26 00:04 c_schmitz Assigned To c_schmitz => rakete
2009-11-26 13:45 rakete Note Added: 10274
2009-11-26 13:49 rakete Note Edited: 10274
2009-11-26 19:09 c_schmitz Note Added: 10282
2009-11-27 09:50 user5628 Note Added: 10284
2009-11-27 10:26 c_schmitz Note Added: 10285
2009-11-27 11:04 rakete Note Added: 10286
2009-12-01 15:29 user5703 Note Added: 10390
2009-12-15 11:03 rakete Note Added: 10576
2010-01-16 16:19 c_schmitz Relationship added related to 04048
2010-01-16 16:19 c_schmitz Assigned To rakete => harsha
2010-01-17 10:51 harsha File Added: emailvalidator.patch
2010-01-17 10:53 harsha Note Added: 10803
2010-01-17 19:35 harsha File Deleted: emailvalidator.patch
2010-01-17 19:38 harsha Note Added: 10805
2010-01-19 20:22 harsha File Added: emailvalidation.patch
2010-01-20 09:55 rakete Note Added: 10814
2010-01-21 23:21 c_schmitz Assigned To harsha => c_schmitz
2010-01-27 04:59 harsha Note Added: 10908
2010-01-27 22:57 c_schmitz Assigned To c_schmitz => harsha
2010-01-27 22:58 c_schmitz Note Added: 10910
2010-01-28 20:59 harsha Note Added: 10926
2010-01-29 21:51 harsha File Added: email-validator.patch
2010-01-29 22:00 harsha Note Added: 10936
2010-01-31 14:38 harsha Note Added: 10943
2010-01-31 14:38 harsha Status assigned => resolved
2010-01-31 14:38 harsha Fixed in Version => 1.87+
2010-01-31 14:38 harsha Resolution open => fixed
2010-02-04 18:40 c_schmitz Status resolved => closed
2010-10-25 00:17 c_schmitz Category Survey Design => Survey design
2019-11-01 17:25 c_schmitz Category Survey design => Survey editing