Skip to content
Browse files

Added a check for the availability of dns_get_record()

  • Loading branch information...
1 parent 7333cc5 commit 37df0b353c7c9298d7dbbe1f4c3182cd2242ac3e @DaSourcerer committed May 16, 2012
Showing with 1 addition and 1 deletion.
  1. +1 −1 framework/validators/CEmailValidator.php
View
2 framework/validators/CEmailValidator.php
@@ -85,7 +85,7 @@ public function validateValue($value)
$domain=rtrim(substr($value,strpos($value,'@')+1),'>');
if($valid && $this->checkMX && function_exists('checkdnsrr'))
$valid=checkdnsrr($domain,'MX');
- if($valid && $this->checkPort && function_exists('fsockopen'))
+ if($valid && $this->checkPort && function_exists('fsockopen') && function_exists('dns_get_record'))
@mdomba
mdomba added a note May 21, 2012

It can happen that fsockopen is available but dns_get_record not.

Wouldn't be better to fallback to previous test for this case - fsockopen('domain',25)

@DaSourcerer
Owner
DaSourcerer added a note May 21, 2012

Hm. Part of #164 is that the current test is pretty pointless. You will rarely encounter hosts were the 2nd-level domain is the same as the mx server. CEmailValidator.checkPort should really provide a more in-depth method of determining reachable MXes than just checkMX.

@mdomba
mdomba added a note May 21, 2012

My note is regarding when dns_get_record is not available.

Most dedicated and VPS servers are set as webserver and mail server, so this would work in those cases...

@DaSourcerer
Owner
DaSourcerer added a note May 22, 2012

I see your point but I can't say I'm happy with that. Anyway, said fallback is now part of fe9bce0

@mdomba
mdomba added a note May 22, 2012

please explain why you are not happy... you think it would be better to not make any check in this case (dns_get_record not available) ?

@DaSourcerer
Owner
DaSourcerer added a note May 22, 2012

No, I just still think that fsockopen() on the domain's port 25 is a weak check. OTOH I've got no better solution at hand right now.

@mdomba
mdomba added a note May 22, 2012

Please take a look at the description for "checkMX", the same should be added for the checkPort and fsockopen & dns_get_record function

Regarding this to make the explanation short without explaining what is checked if one is available and the other not... it's better to remove the last commit and sorry for giving you extra work here.

@DaSourcerer
Owner
DaSourcerer added a note May 22, 2012

All done now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
$valid=$this->checkMxPorts($domain);
return $valid;
}

0 comments on commit 37df0b3

Please sign in to comment.
Something went wrong with that request. Please try again.