If you do not have error logging turned on by default (php.ini), but rather use run time functions to set this up, and you have syntax errors in your script then error reporting will not work, since the script is first parsed and then only executed if parsing went ok.
As such, I'm guessing you managed to sneak in an error when changing your code.
The documentation states that DNS_ANY is not as reliable (across platforms) as DNS_ALL. You'd have to verify that it does indeed do the trick for you. You could also perform two calls to dns_get_record, once with DNS_A and once with DNS_MX.
Since this function returns either an array on success, or false on failure, you should test for success.
$dns = dns_get_record( $domain, DNS_ALL );
// ok, proceed with foreach loop
if ($dns) {
}
// dns_get_record returned false for some reason. Perhaps log $domain?
else {
}