mirror of
https://github.com/egulias/EmailValidator.git
synced 2026-09-11 10:36:45 +00:00
Compare commits
3 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 04c6cdf987 | |||
| cc9defe645 | |||
| 50aaa0b18f |
@@ -103,6 +103,7 @@ class DomainPart extends Parser
|
|||||||
{
|
{
|
||||||
$domain = '';
|
$domain = '';
|
||||||
$openedParenthesis = 0;
|
$openedParenthesis = 0;
|
||||||
|
$openBrackets = false;
|
||||||
do {
|
do {
|
||||||
$prev = $this->lexer->getPrevious();
|
$prev = $this->lexer->getPrevious();
|
||||||
|
|
||||||
@@ -130,7 +131,7 @@ class DomainPart extends Parser
|
|||||||
$this->checkConsecutiveDots();
|
$this->checkConsecutiveDots();
|
||||||
$this->checkDomainPartExceptions($prev);
|
$this->checkDomainPartExceptions($prev);
|
||||||
|
|
||||||
if ($this->hasBrackets()) {
|
if ($openBrackets = $this->hasBrackets($openBrackets)) {
|
||||||
$this->parseDomainLiteral();
|
$this->parseDomainLiteral();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -287,8 +288,12 @@ class DomainPart extends Parser
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function hasBrackets()
|
protected function hasBrackets($openBrackets)
|
||||||
{
|
{
|
||||||
|
if ($this->lexer->token['type'] === EmailLexer::S_CLOSEBRACKET && !$openBrackets) {
|
||||||
|
throw new \InvalidArgumentException('ERR_EXPECTING_OPENBRACKET');
|
||||||
|
}
|
||||||
|
|
||||||
if ($this->lexer->token['type'] !== EmailLexer::S_OPENBRACKET) {
|
if ($this->lexer->token['type'] !== EmailLexer::S_OPENBRACKET) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -63,6 +63,7 @@ class EmailValidatorTest extends \PHPUnit_Framework_TestCase
|
|||||||
array('test@email^'),
|
array('test@email^'),
|
||||||
array('test@email%'),
|
array('test@email%'),
|
||||||
array('test@email$'),
|
array('test@email$'),
|
||||||
|
array('test@email.com.au'),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -123,6 +124,8 @@ class EmailValidatorTest extends \PHPUnit_Framework_TestCase
|
|||||||
array('test@email>'),
|
array('test@email>'),
|
||||||
array('test@email<'),
|
array('test@email<'),
|
||||||
array('test@email{'),
|
array('test@email{'),
|
||||||
|
array('test@email.com]'),
|
||||||
|
array('test@ema[il.com'),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user