Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Fix code to adhere to coding conventions, trim split values and add s…
…ome explanatory comment.
  • Loading branch information
Thomas Off committed Aug 16, 2011
commit e317bbbfeaeeff08a1a9b7d28d43bb2c9468e643
11 changes: 7 additions & 4 deletions src/Symfony/Component/Validator/Constraints/EmailValidator.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,18 +43,20 @@ public function isValid($value, Constraint $constraint)
$value = (string) $value;

if ($constraint->multiple) {
// Split into pieces and validate each part.
$parts = explode(',', $value);
$valid = true;
foreach ($parts as $part) {
$part = trim($part);

if ('' === $part) {
$valid = false;
}
else {
} else {
$valid = $valid && $this->checkAddress($part, $constraint);
}
}
}
else {
} else {
// Validate a single address.
$valid = $this->checkAddress($value, $constraint);
}

Expand Down Expand Up @@ -107,4 +109,5 @@ private function checkMX($host)
{
return checkdnsrr($host, 'MX');
}

}