Bug #76966 [Opn->Fbk]: checkdnsrr function return inconsistent results

From: Date: Fri, 05 Oct 2018 00:30:05 +0000
Subject: Bug #76966 [Opn->Fbk]: checkdnsrr function return inconsistent results
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-217425@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=76966&edit=1 ID: 76966 Updated by: pmmaga@php.net Reported by: stephane at dubishere dot com Summary: checkdnsrr function return inconsistent results -Status: Open +Status: Feedback Type: Bug Package: *General Issues Operating System: Ubuntu 18.04 PHP Version: 7.2.10 Block user comment: N Private report: N New Comment: 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. Previous Comments: ------------------------------------------------------------------------ [2018-10-03 16:25:58] 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. ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=76966&edit=1

« previous php.bugs (#217425) next »