I tried to create a user with email address 'John.O'Connor@foo.bar.com' but the email address validation does not accept the single quote character (ASCII 39).
In the specification are the following special characters allowed:
!#$%&'*+-/=?^_`{|}~
https://en.wikipedia.org/wiki/Email_address
The user should be created!
Creation fails, the email address is not valid.
In the class JMailHelper (libraries/joomla/mail/helper.php) method isMailAddress() on line 130
the allowed special characters are !#$%&'*+\/=?^_`{|}~-
The ' right single quotation mark (ASCII 8217) is't an allowed character.
I guess we can close this
The ASCII character 39 is not accepted in Joomla, but is a valid character according to the specification.
In the code it accepts ASCII character 8217 instead of 39, see code:
https://github.com/joomla/joomla-cms/blob/staging/libraries/joomla/mail/helper.php#L130
Change:
hotkeeper@91e32f3
Looks like you pasted the wrong character in your description as, indeed, we do accept 8217 (’) and not 39 (')
Additional comments
In the class JMailHelper (libraries/joomla/mail/helper.php) method isMailAddress() on line 130
the allowed special characters are !#$%&'*+/=?^_`{|}~-
The ' right single quotation mark (ASCII 8217) is't an allowed character.
There must be a reason. Forgot why.
This is also the case in our tests:
array("o'reilly@there.com", false),
array("o’reilly@there.com", true)
This is wrong and does not follow the specification, the character 39 should be accepted instead of 8217.
https://en.wikipedia.org/wiki/Email_address#Local-part
The email address is specified in RFC-2822:
addr-spec = local-part "@" domain
local-part = dot-atom / quoted-string / obs-local-part
domain = dot-atom / domain-literal / obs-domain
domain-literal = [CFWS] "[" *([FWS] dcontent) [FWS] "]" [CFWS]
dcontent = dtext / quoted-pair
dtext = NO-WS-CTL / ; Non white space controls
%d33-90 / ; The rest of the US-ASCII
%d94-126 ; characters not including "[",
; "]", or "\"
https://tools.ietf.org/html/rfc2822#section-3.4.1
atext = ALPHA / DIGIT / ; Any character except controls,
"!" / "#" / ; SP, and specials.
"$" / "%" / ; Used for atoms
"&" / "'" /
"*" / "+" /
"-" / "/" /
"=" / "?" /
"^" / "_" /
"`" / "{" /
"|" / "}" /
"~"
atom = [CFWS] 1*atext [CFWS]
dot-atom = [CFWS] dot-atom-text [CFWS]
dot-atom-text = 1*atext *("." 1*atext)
Agree. We do have this wrong from a very long time.
I am making a PR now as there are many things to touch.
One sec, I post the patch
Closing since we have a patch for this.
Please test.
Status | New | ⇒ | Closed |
Closed_Date | 0000-00-00 00:00:00 | ⇒ | 2016-11-08 11:58:51 |
Closed_By | ⇒ | jeckodevelopment |
that is correct it is not a valid character as you have stated
On 7 November 2016 at 10:28, hotkeeper notifications@github.com wrote:
Brian Teeman
Co-founder Joomla! and OpenSourceMatters Inc.
https://brian.teeman.net/ http://brian.teeman.net/