Skip to content

Commit f1450f3

Browse files
Merge branch '2.3' into 2.7
* 2.3: [Validator] use correct term for a property in docblock (not "option") [PropertyAccess] Remove most ref mismatches to improve perf [Validator] EmailValidator cannot extract hostname if email contains multiple @ symbols [NumberFormatter] Fix invalid numeric literal on PHP 7 Use XML_ELEMENT_NODE in nodeType check [PropertyAccess] Reduce overhead of UnexpectedTypeException tracking [PropertyAccess] Throw an UnexpectedTypeException when the type do not match [FrameworkBundle] Add tests for the Controller class Conflicts: src/Symfony/Bundle/FrameworkBundle/Tests/Controller/ControllerTest.php src/Symfony/Component/Intl/NumberFormatter/NumberFormatter.php src/Symfony/Component/PropertyAccess/PropertyAccessor.php src/Symfony/Component/PropertyAccess/PropertyAccessorInterface.php src/Symfony/Component/PropertyAccess/PropertyPath.php src/Symfony/Component/PropertyAccess/Tests/PropertyAccessorTest.php src/Symfony/Component/Validator/Constraints/EmailValidator.php
2 parents 18743f9 + 5ae3aff commit f1450f3

File tree

3 files changed

+15
-3
lines changed

3 files changed

+15
-3
lines changed

Constraint.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,9 @@
1919
/**
2020
* Contains the properties of a constraint definition.
2121
*
22-
* A constraint can be defined on a class, an option or a getter method.
22+
* A constraint can be defined on a class, a property or a getter method.
2323
* The Constraint class encapsulates all the configuration required for
24-
* validating this class, option or getter result successfully.
24+
* validating this class, property or getter result successfully.
2525
*
2626
* Constraint instances are immutable and serializable.
2727
*

Constraints/EmailValidator.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ public function validate($value, Constraint $constraint)
9393
return;
9494
}
9595

96-
$host = substr($value, strpos($value, '@') + 1);
96+
$host = substr($value, strrpos($value, '@') + 1);
9797

9898
// Check for host DNS resource records
9999
if ($constraint->checkMX) {

Tests/Constraints/EmailValidatorTest.php

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -143,4 +143,16 @@ public function getDnsChecks()
143143
array('AAAA', Email::HOST_CHECK_FAILED_ERROR),
144144
);
145145
}
146+
147+
public function testHostnameIsProperlyParsed()
148+
{
149+
DnsMock::withMockedHosts(array('baz.com' => array(array('type' => 'MX'))));
150+
151+
$this->validator->validate(
152+
'"foo@bar"@baz.com',
153+
new Email(array('checkMX' => true))
154+
);
155+
156+
$this->assertNoViolation();
157+
}
146158
}

0 commit comments

Comments
 (0)