php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #53092 dns_get_record does not return false on dns server failure
Submitted: 2010-10-18 05:30 UTC Modified: 2014-07-15 12:42 UTC
Votes:17
Avg. Score:4.8 ± 0.5
Reproduced:16 of 16 (100.0%)
Same Version:6 (37.5%)
Same OS:4 (25.0%)
From: gunni at wave dot is Assigned:
Status: Closed Package: Network related
PHP Version: 5.3.3 OS: Ubuntu Server 10.04
Private report: No CVE-ID: None
 [2010-10-18 05:30 UTC] 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.


Patches

Add a Patch

Pull Requests

Pull requests:

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2010-10-18 05:37 UTC] 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 06:30 UTC] 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-19 22:18 UTC] felipe@php.net
-Package: Unknown/Other Function +Package: Network related
 [2011-03-05 09:50 UTC] error at ioerror dot us
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.
 [2014-07-15 12:42 UTC] datibbaw@php.net
With the PR applied and setting the name server to ::1, it produces the following warning:

Warning: dns_get_record(): A temporary server error occurred.
 [2014-12-01 06:41 UTC] stas@php.net
Automatic comment on behalf of datibbaw
Revision: http://git.php.net/?p=php-src.git;a=commit;h=7b44790db557517618ddd21d90740f290b8cb29d
Log: Fix #53092 - dns_get_record does not return false on dns server failure
 [2014-12-01 06:41 UTC] stas@php.net
-Status: Open +Status: Closed
 [2014-12-01 06:44 UTC] stas@php.net
Automatic comment on behalf of datibbaw
Revision: http://git.php.net/?p=php-src.git;a=commit;h=d037785165854872fc9b3b49ed3290ae25f939e6
Log: Fix #53092 - dns_get_record does not return false on dns server failure
 [2014-12-01 06:44 UTC] stas@php.net
Automatic comment on behalf of datibbaw
Revision: http://git.php.net/?p=php-src.git;a=commit;h=f2b7aeda2b79b0f2a4f4ba2bcdebe3574b1d3a9e
Log: Fix #53092 - dns_get_record does not return false on dns server failure
 [2014-12-01 07:33 UTC] ab@php.net
Automatic comment on behalf of datibbaw
Revision: http://git.php.net/?p=php-src.git;a=commit;h=7b44790db557517618ddd21d90740f290b8cb29d
Log: Fix #53092 - dns_get_record does not return false on dns server failure
 [2014-12-05 07:00 UTC] ab@php.net
Automatic comment on behalf of datibbaw
Revision: http://git.php.net/?p=php-src.git;a=commit;h=f2b7aeda2b79b0f2a4f4ba2bcdebe3574b1d3a9e
Log: Fix #53092 - dns_get_record does not return false on dns server failure
 [2014-12-05 07:00 UTC] ab@php.net
Automatic comment on behalf of datibbaw
Revision: http://git.php.net/?p=php-src.git;a=commit;h=d037785165854872fc9b3b49ed3290ae25f939e6
Log: Fix #53092 - dns_get_record does not return false on dns server failure
 [2014-12-05 07:00 UTC] ab@php.net
Automatic comment on behalf of datibbaw
Revision: http://git.php.net/?p=php-src.git;a=commit;h=7b44790db557517618ddd21d90740f290b8cb29d
Log: Fix #53092 - dns_get_record does not return false on dns server failure
 [2016-07-20 11:40 UTC] davey@php.net
Automatic comment on behalf of datibbaw
Revision: http://git.php.net/?p=php-src.git;a=commit;h=f2b7aeda2b79b0f2a4f4ba2bcdebe3574b1d3a9e
Log: Fix #53092 - dns_get_record does not return false on dns server failure
 
PHP Copyright © 2001-2019 The PHP Group
All rights reserved.
Last updated: Sat Oct 19 12:01:27 2019 UTC