php.net |  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
View Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
If you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: stephane at dubishere dot com
New email:
PHP Version: OS:

 

 [2018-10-03 16:25 UTC] stephane at dubishere dot com
Description:
------------
---
From manual page: http://www.php.net/function.checkdnsrr
---

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        route53.myapp.com  >> 10.1.1.101   
- one CNAME record    route666.myapp.com  >> route53.myapp.com   

*/


// >> control the OS/hosts is seeing the DNS records: 
var_dump( gethostbyname('route53.myapp.com'));      >> 10.1.1.101 
var_dump( gethostbyname('route666.myapp.com'));     >> 10.1.1.101 




// My first test: 

var_dump( checkdnsrr('route53.myapp.com', 'A'));      >> true

var_dump( checkdnsrr('route53.myapp.com'));           >> false  !!! 

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




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

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


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2018-10-05 00:30 UTC] pmmaga@php.net
-Status: Open +Status: Feedback
 [2018-10-05 00:30 UTC] pmmaga@php.net
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 route666.myapp.com A` you can verify this.
 [2018-11-18 22:39 UTC] cmb@php.net
-Status: Feedback +Status: No Feedback
 [2018-11-18 22:39 UTC] cmb@php.net
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: Thu Oct 03 14:01:27 2024 UTC