mirror of
https://github.com/egulias/EmailValidator.git
synced 2026-08-30 12:07:59 +00:00
unclosed comment
This commit is contained in:
@@ -11,7 +11,6 @@ use Egulias\EmailValidator\InvalidEmail;
|
||||
*/
|
||||
class EmailValidator
|
||||
{
|
||||
const ERR_UNCLOSEDCOMMENT = 146;
|
||||
const ERR_UNCLOSEDDOMLIT = 147;
|
||||
const ERR_FWS_CRLF_X2 = 148;
|
||||
const ERR_FWS_CRLF_END = 149;
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
<?php
|
||||
|
||||
namespace Egulias\EmailValidator\Exception;
|
||||
|
||||
use Egulias\EmailValidator\InvalidEmail;
|
||||
|
||||
class UnclosedComment extends InvalidEmail
|
||||
{
|
||||
const CODE = 146;
|
||||
const REASON = "No colosing comment token found";
|
||||
}
|
||||
@@ -9,6 +9,7 @@ use Egulias\EmailValidator\Exception\ConsecutiveDot;
|
||||
use Egulias\EmailValidator\Exception\ExpectedQPair;
|
||||
use Egulias\EmailValidator\Exception\ExpectingATEXT;
|
||||
use Egulias\EmailValidator\Exception\ExpectingCTEXT;
|
||||
use Egulias\EmailValidator\Exception\UnclosedComment;
|
||||
use Egulias\EmailValidator\Exception\UnclosedQuotedString;
|
||||
|
||||
abstract class Parser
|
||||
@@ -70,7 +71,7 @@ abstract class Parser
|
||||
$this->lexer->find(EmailLexer::S_CLOSEPARENTHESIS);
|
||||
return true;
|
||||
} catch (\RuntimeException $e) {
|
||||
throw new \InvalidArgumentException('ERR_UNCLOSEDCOMMENT');
|
||||
throw new UnclosedComment();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -13,6 +13,7 @@ use Egulias\EmailValidator\Exception\ExpectingATEXT;
|
||||
use Egulias\EmailValidator\Exception\ExpectingDTEXT;
|
||||
use Egulias\EmailValidator\Exception\NoDomainPart;
|
||||
use Egulias\EmailValidator\Exception\NoLocalPart;
|
||||
use Egulias\EmailValidator\Exception\UnclosedComment;
|
||||
use Egulias\EmailValidator\Exception\UnclosedQuotedString;
|
||||
|
||||
class EmailValidatorTest extends \PHPUnit_Framework_TestCase
|
||||
@@ -162,7 +163,7 @@ class EmailValidatorTest extends \PHPUnit_Framework_TestCase
|
||||
array(DotAtStart::CODE, 'example@.localhost'),
|
||||
array(DotAtEnd::CODE, 'example@localhost.'),
|
||||
array(DotAtEnd::CODE, 'example.@example.co.uk'),
|
||||
array(EmailValidator::ERR_UNCLOSEDCOMMENT, '(example@localhost'),
|
||||
array(UnclosedComment::CODE, '(example@localhost'),
|
||||
array(UnclosedQuotedString::CODE, '"example@localhost'),
|
||||
array(ExpectingATEXT::CODE, 'exa"mple@localhost'),
|
||||
//This was the original. But atext is not allowed after \n
|
||||
|
||||
Reference in New Issue
Block a user