|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #76966 checkdnsrr function return inconsistent results
Submitted: 2018-10-03 16:25 UTC Modified: 2018-11-18 22:39 UTC
From: stephane at dubishere dot com Assigned:
Status: No Feedback Package: *General Issues
PHP Version: 7.2.10 OS: Ubuntu 18.04
Private report: No CVE-ID: None
Have you experienced this issue?
Rate the importance of this bug to you:

 [2018-10-03 16:25 UTC] stephane at dubishere dot com
From manual page:

Root issue: I'm having networking problems when setting up the session handler to use Redis.

If I setup the session handler using an IP address pointing to my Redis host, it works fine. If I use a domain (DNS or my linux /etc/hosts file) it doesn't work, sessions are not saved in Redis.

So i've started looking into some networking related function to test this behaviour and see if I could find a DNS-related issue somewhere, and here I've encountered weird results for checkdnsrr() function.

Hopefully, fixing these would fix my Redis connection issue.

Test script:
In AWS using route53, I've set 2 DNS records: 

- one A record  >>   
- one CNAME record  >>   


// >> control the OS/hosts is seeing the DNS records: 
var_dump( gethostbyname(''));      >> 
var_dump( gethostbyname(''));     >> 

// My first test: 

var_dump( checkdnsrr('', 'A'));      >> true

var_dump( checkdnsrr(''));           >> false  !!! 

### If I have a A record, looking for ANY type of records should return true too.

// My second  test:
var_dump( checkdnsrr(''));          >> true
var_dump( checkdnsrr('', 'A'));     >> true  !!!
var_dump( checkdnsrr('', 'CNAME')); >> true

### If route666 is a CNAME, testing it's a A record should return false.


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2018-10-05 00:30 UTC]
-Status: Open +Status: Feedback
 [2018-10-05 00:30 UTC]
About your first test, as mentioned in the manual, the default value for type is "MX" and not "ANY".

About the second test, although CNAME is not an A, typically an A record is part of the answer when you query the DNS for an A record of that domain. If you try `dig A` you can verify this.
 [2018-11-18 22:39 UTC]
-Status: Feedback +Status: No Feedback
 [2018-11-18 22:39 UTC]
No feedback was provided. The bug is being suspended because
we assume that you are no longer experiencing the problem.
If this is not the case and you are able to provide the
information that was requested earlier, please do so and
change the status of the bug back to "Re-Opened". Thank you.
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Tue May 28 23:01:31 2024 UTC