php dns_get_records( host, type ) is returning false with type=DNS_ALL but returns DNS records with DNS_TXT or DNS_A - Hack The Tech - Latest News related to Computer and Technology

Hack The Tech - Latest News related to Computer and Technology

Get Daily Latest News related to Computer and Technology and hack the world.

Saturday, June 25, 2022

php dns_get_records( host, type ) is returning false with type=DNS_ALL but returns DNS records with DNS_TXT or DNS_A

What investigating a malfunction in a WordPress plugin, I noticed that

$records = @dns_get_record( $host, DNS_ALL );

is returning False whilst

$records = @dns_get_record( $host, DNS_A + DNS_TXT );

is returning the array I needed.

However, I still don't understand why it happened and I want to make sure that no one else has to waste some hours debugging because of this issue.

Things I tried so far:

  • I removed the @ sign to allow errors and warnings, however I did not no error messages were found, nor there were any exceptions.
  • I tried DNS_ANY (the default) and that did not produce the array of records.
  • The issue seems to be on the server where the app is hosted. For example, when running dns_get_record("google.com") I am getting an array with 19 records.

Any idea why this happened or where to look for potential errors?



source https://stackoverflow.com/questions/72745677/php-dns-get-records-host-type-is-returning-false-with-type-dns-all-but-retur

No comments:

Post a Comment