Backporting the changes made in #139 (#140)

* Backporting the changes made in https://github.com/egulias/EmailValidator/pull/139 so this functionality is also accessible in the 1.2.x releases.
This fix allows for more compliance with the DNS RFC. Explanation here: https://github.com/egulias/EmailValidator/pull/139/commits/08bac068c26edd210daa259a2819d7dfd7438091
This commit is contained in:
Sebastiaan Provost
2017-02-03 23:48:59 +01:00
committed by Eduardo Gulias Davis
parent b8bb147f46
commit 5642614492
@@ -184,7 +184,10 @@ class EmailValidator implements EmailValidatorInterface
*/
protected function checkDNS()
{
$mxRecordExists = checkdnsrr(trim($this->parser->getParsedDomainPart()), 'MX');
$host = $this->parser->getParsedDomainPart();
$host = rtrim($host, '.') . '.';
$mxRecordExists = checkdnsrr($host, 'MX');
if (!$mxRecordExists) {
$this->warnings[] = self::DNSWARN_NO_RECORD;