diff --git a/lib/Doctrine/Validator/Email.php b/lib/Doctrine/Validator/Email.php index 29c3a097a..e089f36dd 100644 --- a/lib/Doctrine/Validator/Email.php +++ b/lib/Doctrine/Validator/Email.php @@ -29,9 +29,9 @@ class Doctrine_Validator_Email { $domain_literal = "\\x5b($dtext|$quoted_pair)*\\x5d"; $quoted_string = "\\x22($qtext|$quoted_pair)*\\x22"; $domain_ref = $atom; - $sub_domain = "($domain_ref|$domain_literal)"; + $sub_domain = "($domain_ref|$domain_literal)"; $word = "($atom|$quoted_string)"; - $domain = "$sub_domain(\\x2e$sub_domain)*"; + $domain = "$sub_domain(\\x2e$sub_domain)+"; $local_part = "$word(\\x2e$word)*"; $addr_spec = "$local_part\\x40$domain"; diff --git a/tests/ValidatorTestCase.php b/tests/ValidatorTestCase.php index c1aea018e..be95d0daf 100644 --- a/tests/ValidatorTestCase.php +++ b/tests/ValidatorTestCase.php @@ -143,6 +143,9 @@ class Doctrine_ValidatorTestCase extends Doctrine_UnitTestCase { $this->assertFalse($validator->validate($email,"address","example@e..",null)); + $this->assertTrue($validator->validate($email,"address","null@pookey.co.uk",null)); + $this->assertTrue($validator->validate($email,"address","null@pookey.com",null)); + $this->assertTrue($validator->validate($email,"address","null@users.doctrine.pengus.net",null)); }