Skip to content

Fix bug #81618: dns_get_record failure on FreeBSD #7650

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions ext/standard/dns.c
Original file line number Diff line number Diff line change
Expand Up @@ -946,8 +946,15 @@ PHP_FUNCTION(dns_get_record)
n = php_dns_search(handle, hostname, C_IN, type_to_fetch, answer.qb2, sizeof answer);

if (n < 0) {
#if defined(HAVE_RES_NSEARCH)
int r_h_errno = handle->res_h_errno;
#endif
php_dns_free_handle(handle);
#if defined(HAVE_RES_NSEARCH)
switch (r_h_errno) {
#else
switch (h_errno) {
#endif
case NO_DATA:
case HOST_NOT_FOUND:
continue;
Expand Down
12 changes: 12 additions & 0 deletions ext/standard/tests/bug81618.phpt
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
--TEST--
Bug #81618: dns_get_record failure on FreeBSD
--FILE--
<?php
$ret = dns_get_record('www.google.com', DNS_A + DNS_CNAME);

echo ($ret !== false && count($ret) > 0);

?>

--EXPECT--
1