Skip to content

Commit

Permalink
Reset the label when a S_DOT is encountered. (#297)
Browse files Browse the repository at this point in the history
This will allow multi label domain's to still validate correctly.

Reset the label when a S_DOT is encountered.
  • Loading branch information
johncongdon authored Apr 1, 2021
1 parent 95979e2 commit c81f18a
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/Parser/DomainPart.php
Original file line number Diff line number Diff line change
Expand Up @@ -280,9 +280,9 @@ private function checkLabelLength(bool $isEndOfDomain = false) : Result
{
if ($this->lexer->token['type'] === EmailLexer::S_DOT || $isEndOfDomain) {
if ($this->isLabelTooLong($this->label)) {
$this->label = '';
return new InvalidEmail(new LabelTooLong(), $this->lexer->token['value']);
}
$this->label = '';
}
$this->label .= $this->lexer->token['value'];
return new ValidEmail();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ public function getValidEmails()
['validipv4@[127.0.0.0]'],
['validipv4@127.0.0.0'],
['withhyphen@domain-exam.com'],
['valid_long_domain@71846jnrsoj91yfhc18rkbrf90ue3onl8y46js38kae8inz0t1.5a-xdycuau.na49.le.example.com']
);
}

Expand Down

0 comments on commit c81f18a

Please sign in to comment.