I have started using Zend_Validate_EmailAddress with the mx and deep options set to true. I think I am getting some false negatives when it comes to MX records that have IP addresses in the reserved IP ranges.
A good example is the MX records for harn.ufl.edu. It appear that it’s failing because of IP addresses in the 128.0.0.0/16 range. It does however have one record that uses 8.6.245.30, which is not in the reserved range.
Another example is the MX record for martinhealth.org. It’s MX record domain uses 198.136.38.2.
Is this a case of something that’s technically incorrect but actually works?
As the comments on my post allude, there is a bug in
Zend_Validate_EmailAddress::_isReserved. Not only is it buggy, but it’s difficult to understand the logic flow. It was aprivatefunction, so I changed it toprotectedso I could override it in my sub-class. There were also some incorrect ranges in the$_invalidIparray.For my logic check, I decided that the simplest (clearest?) way to compare IP addresses was to convert them to their decimal integer equivalents.
Here’s my sub-class: