Browse files

Changing how email validation methods are applied, to fix issues wher…

…e getmxrr() exists but the domain being validated does not have MX records correctly configured. Fixes #634
  • Loading branch information...
1 parent 45d052b commit 1c1c51185309f89d22a6ce7a9cc999354e50c7e5 @markstory markstory committed May 6, 2010
Showing with 4 additions and 4 deletions.
  1. +4 −4 cake/libs/validation.php
View
8 cake/libs/validation.php
@@ -501,11 +501,11 @@ function email($check, $deep = false, $regex = null) {
}
if ($return === true && preg_match('/@(' . $_this->__pattern['hostname'] . ')$/i', $_this->check, $regs)) {
- if (function_exists('getmxrr')) {
- return getmxrr($regs[1], $mxhosts);
+ if (function_exists('getmxrr') && getmxrr($regs[1], $mxhosts)) {
+ return true;
}
- if (function_exists('checkdnsrr')) {
- return checkdnsrr($regs[1], 'MX');
+ if (function_exists('checkdnsrr') && checkdnsrr($regs[1], 'MX')) {
+ return true;
}
return is_array(gethostbynamel($regs[1]));
}

0 comments on commit 1c1c511

Please sign in to comment.