Bug #53092 [Com]: dns_get_record does not return false on dns server failure

From: Date: Sat, 05 Mar 2011 08:50:54 +0000
Subject: Bug #53092 [Com]: dns_get_record does not return false on dns server failure
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-159231@lists.php.net to get a copy of this message
Edit report at http://bugs.php.net/bug.php?id=53092&edit=1 ID: 53092 Comment by: error at ioerror dot us Reported by: gunni at wave dot is Summary: dns_get_record does not return false on dns server failure Status: Open Type: Bug Package: Network related Operating System: Ubuntu Server 10.04 PHP Version: 5.3.3 Block user comment: N Private report: N New Comment: It should be noted that this general issue also affects gethostbyname() and its friends; PHP provides no way to distinguish between NXDOMAIN and SERVFAIL. I have a feature which must distinguish between them to work properly, and so I can't roll it out. Previous Comments: ------------------------------------------------------------------------ [2010-10-18 06:30:03] gunni at wave dot is i fail hard Requests for existing domain names when dns works: OK (array with stuff) Requests for unexisting domain names when dns works: OK (empty array) Requests for existing domain names when dns DOES NOT work: FAIL (empty array) Requests for unexisting domain names when dns DOES NOT work: FAIL (empty array) ------------------------------------------------------------------------ [2010-10-18 05:37:48] gunni at wave dot is i should clarify: Requests for existing domain names when dns works: OK (array with stuff) Requests for unexisting domain names when dns works: OK (empty array) Requests for existing domain names when dns works: FAIL (empty array) Requests for unexisting domain names when dns works: FAIL (empty array) ------------------------------------------------------------------------ [2010-10-18 05:30:33] gunni at wave dot is Description: ------------ dns_get_record does not return false on dns server failure If you make an example dns failure by changing resolv.conf to some silly ip (i used 1.3.3.7) Requests for existing domain names: OK (array with stuff) Requests for unexisting domain names: OK (empty array) Requests for any domain when dns server does not respond: FAIL (empty array) Which makes it impossible to see if the dns server failed or if the domain doesn't exist. Documentation states: "This function returns an array of associative arrays, or FALSE on failure." When the DNS server fails, that's considered a failure, correct? Test script: --------------- <?php // try various domains with dns working/not working print_r(dns_get_record('google.com', DNS_A)); ?> Expected result: ---------------- if dns does not respond within timeout, return false. ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/bug.php?id=53092&edit=1

« previous php.bugs (#159231) next »