Skip to content

Commit

Permalink
Merge pull request #44 from egulias/kbond-semicolon-fail
Browse files Browse the repository at this point in the history
From #43 - Kbond semicolon fail
egulias committed Jan 4, 2015

Unverified

This commit is not signed, but one or more authors requires that any commit attributed to them is signed.
2 parents add559b + 833b3e7 commit ab0bcfb
Showing 3 changed files with 74 additions and 42 deletions.
82 changes: 43 additions & 39 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions src/Egulias/EmailValidator/Parser/DomainPart.php
Original file line number Diff line number Diff line change
@@ -104,6 +104,10 @@ protected function doParseDomainPart()
{
$domain = '';
do {
if ($this->lexer->token['type'] === EmailLexer::S_SEMICOLON) {
throw new \InvalidArgumentException('ERR_EXPECTING_ATEXT');
}

$prev = $this->lexer->getPrevious();

if ($this->lexer->token['type'] === EmailLexer::S_SLASH) {
30 changes: 27 additions & 3 deletions tests/egulias/Tests/EmailValidator/EmailValidatorTest.php
Original file line number Diff line number Diff line change
@@ -108,6 +108,7 @@ public function getInvalidEmails()
array('[email protected] \r\n\r\n'),
array('[email protected] \r\n\r\n '),
array('test@iana/icann.org'),
array('test@foo;bar.com'),
);
}

@@ -173,27 +174,48 @@ public function testInvalidEmailsWithDnsCheckAndStrictMode($warnings, $email)
public function getInvalidEmailsWithWarnings()
{
return array(
array(array( EmailValidator::DEPREC_CFWS_NEAR_AT,), 'example @example.co.uk'),
array(array( EmailValidator::DEPREC_CFWS_NEAR_AT,), 'example@ example.co.uk'),
array(array( EmailValidator::CFWS_COMMENT,), 'example@example(examplecomment).co.uk'),
array(
array(
EmailValidator::DEPREC_CFWS_NEAR_AT,
EmailValidator::DNSWARN_NO_RECORD
),
'example @example.co.uk'
),
array(
array(
EmailValidator::DEPREC_CFWS_NEAR_AT,
EmailValidator::DNSWARN_NO_RECORD
),
'example@ example.co.uk'
),
array(
array(
EmailValidator::CFWS_COMMENT,
EmailValidator::DNSWARN_NO_RECORD
),
'example@example(examplecomment).co.uk'
),
array(
array(
EmailValidator::CFWS_COMMENT,
EmailValidator::DEPREC_CFWS_NEAR_AT,
EmailValidator::DNSWARN_NO_RECORD,
),
'example(examplecomment)@example.co.uk'
),
array(
array(
EmailValidator::RFC5321_QUOTEDSTRING,
EmailValidator::CFWS_FWS,
EmailValidator::DNSWARN_NO_RECORD,
),
"\"\t\"@example.co.uk"
),
array(
array(
EmailValidator::RFC5321_QUOTEDSTRING,
EmailValidator::CFWS_FWS,
EmailValidator::DNSWARN_NO_RECORD
),
"\"\r\"@example.co.uk"
),
@@ -285,12 +307,14 @@ public function getInvalidEmailsWithWarnings()
array(
array(
EmailValidator::RFC5321_QUOTEDSTRING,
EmailValidator::DNSWARN_NO_RECORD
),
'"example"@example.co.uk'
),
array(
array(
EmailValidator::RFC5322_LOCAL_TOOLONG,
EmailValidator::DNSWARN_NO_RECORD
),
'too_long_localpart_too_long_localpart_too_long_localpart_too_long_localpart@example.co.uk'
),

0 comments on commit ab0bcfb

Please sign in to comment.