-
Notifications
You must be signed in to change notification settings - Fork 136
Conversation
dc2dbd9
to
154dc03
Compare
$this->hostname = $this->idnToUtf8($this->hostname); | ||
|
||
// https://tools.ietf.org/html/rfc5322#section-2.1.1 | ||
if ((strlen($this->localPart) + strlen($this->hostname)) > 994) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess @
sign should be included to the length too.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I actually subtracted 4 from 998 to account for To:
and @
, but did not document it properly.
Thanks for noticing.
a767c9e
to
c593863
Compare
@denis-sokolov The length of 998 is not applicable here. It's just the maximum line length in the SMTP protocol and it's not applicable to email address. (In fact there is no any length limit in the content, just fold the header in multiple lines and content is allowed to exceed 998 characters) Please choose a better RFC as reference, if you can't find a reference just remove the local part constraint. |
// implementation techniques that impose no limits on the | ||
// length of these objects should be used.". | ||
// http://tools.ietf.org/html/rfc5321#section-4.5.3.1 | ||
str_repeat('BobJones', 120).'@domain.com' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Instead use 'line length MM' => str_repeat('x', NN) . '@x',
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
NN will be make more clear what is the expected length (MM)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, updating.
e071c29
to
38d2097
Compare
Thanks for the correction, @Maks3w. |
38d2097
to
a451313
Compare
Finally, a passing test! Sorry for the noise - it passed locally initially, because I had no idn extension. Please disregard the coveralls check, it's dumb. I removed 4 covered lines and the overall coverage now "fell". Stupid algorithm is stupid. |
@denis-sokolov Please read my comment above. Your length limit assumption is wrong. RFC 5321 is not a reference for this. |
@Maks3w, I did read it, it was helpful, thank you. The remaining PR is about RFC 5321 (Internet Message Format) stating "To the maximum extent possible, implementation techniques that impose no limits on the limits of these objects should be used.". |
@@ -32,8 +31,7 @@ class EmailAddress extends AbstractValidator | |||
self::INVALID_SEGMENT => "'%hostname%' is not in a routable network segment. The email address should not be resolved from public network", | |||
self::DOT_ATOM => "'%localPart%' can not be matched against dot-atom format", | |||
self::QUOTED_STRING => "'%localPart%' can not be matched against quoted-string format", | |||
self::INVALID_LOCAL_PART => "'%localPart%' is not a valid local part for the email address", | |||
self::LENGTH_EXCEEDED => "The input exceeds the allowed length", | |||
self::INVALID_LOCAL_PART => "'%localPart%' is not a valid local part for the email address" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Preserve the trailing comma
Yes. I was talking about the 998 line length limit |
right now I have a couple of concerns:
So disable length limit changes should be a validator option. |
a451313
to
e42c180
Compare
The distinction between strict and lax validation is important and is unfortunate.
The same class a few lines above already uses the fallback: return (idn_to_ascii($email) ?: $email); If anything, the new change ensures consistency. |
I was suspecting this come from Zend\Mail :) I think this is almost done. Please add a option named Then we can create a PR against Zend\Mail turning the option to false. |
e42c180
to
db59fcd
Compare
db59fcd
to
b55aaa0
Compare
Done, @Maks3w. |
Allow long email addresses per rfc 5322
The addresses are not only theoretical,
I have recently received emails from Trello and Peerby that exceed the 64 octet limit for the local part already.