|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
Patchesfix_70027.patch (last revision 2015-07-08 16:09 UTC by magicaltux at gmail dot com)Pull RequestsHistoryAllCommentsChangesGit/SVN commits
[2017-01-08 18:10 UTC] ab@php.net
-Status: Open
+Status: Feedback
[2017-01-08 18:10 UTC] ab@php.net
[2017-01-22 04:22 UTC] php-bugs at lists dot php dot net
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Fri Dec 19 06:00:01 2025 UTC |
Description: ------------ dns_get_record() allows retrieving one or multiple DNS records of one or multiple types. When requesting for DNS_A + DNS_AAAA records but only A records are available, then only A records are returned, except on BSD where instead an error is returned. PHP will check h_errno for error, however it seems that FreeBSD 10.x or res_nsearch() will not update this value, and will instead update res_h_errno in the handle. In ext/standard/dns.c after the call to php_dns_search() I have added this debug line: fprintf(stderr, "n=%d h_errno=%d statp->res_h_errno=%d\n", n, h_errno, handle->res_h_errno); The result when running the test script below was: n=53 h_errno=0 statp->res_h_errno=1 n=-1 h_errno=0 statp->res_h_errno=4 So we could when HAVE_RES_NSEARCH is defined do the switch not on h_errno, but handle->res_h_errno. Test script: --------------- var_dump(dns_get_record("www.asahi-net.or.jp", DNS_A + DNS_AAAA)); Expected result: ---------------- array(1) { [0]=> array(5) { ["host"]=> string(19) "www.asahi-net.or.jp" ["class"]=> string(2) "IN" ["ttl"]=> int(40667) ["type"]=> string(1) "A" ["ip"]=> string(13) "202.224.39.34" } } Actual result: -------------- Warning: dns_get_record(): DNS Query failed in test.php on line 2 bool(false)