From 68e418ec08fbfc6f58f6fd2eea70ca8efc8cc7d5 Mon Sep 17 00:00:00 2001 From: Eduardo Gulias Davis Date: Sat, 26 Sep 2020 17:48:38 +0200 Subject: [PATCH] fix #217 (#266) --- src/Parser/DomainPart.php | 3 +++ tests/EmailValidator/Validation/RFCValidationTest.php | 1 + 2 files changed, 4 insertions(+) diff --git a/src/Parser/DomainPart.php b/src/Parser/DomainPart.php index 0613e31..8dba7f1 100644 --- a/src/Parser/DomainPart.php +++ b/src/Parser/DomainPart.php @@ -198,6 +198,9 @@ class DomainPart extends Parser $domain .= $this->lexer->token['value']; $this->lexer->moveNext(); + if ($this->lexer->token['type'] === EmailLexer::S_SP) { + throw new CharNotAllowed(); + } } while (null !== $this->lexer->token['type']); return $domain; diff --git a/tests/EmailValidator/Validation/RFCValidationTest.php b/tests/EmailValidator/Validation/RFCValidationTest.php index 4e72e9e..6a56ef3 100644 --- a/tests/EmailValidator/Validation/RFCValidationTest.php +++ b/tests/EmailValidator/Validation/RFCValidationTest.php @@ -167,6 +167,7 @@ class RFCValidationTest extends TestCase ['test@email<'], ['test@email{'], ['test@ '], + ['test@example.com []'], ]; }