Bug #68081 [Com]: checkdnsrr( 'example.com' ) returns `true` when no MX, only CNAME
| From: | figureonecpr at gmail dot com | Date: | Tue, 23 Sep 2014 07:19:17 +0000 |
| Subject: | Bug #68081 [Com]: checkdnsrr( 'example.com' ) returns `true` when no MX, only CNAME | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-187679@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=68081&edit=1
ID: 68081
Comment by: figureonecpr at gmail dot com
Reported by: figureonecpr at gmail dot com
Summary: checkdnsrr( 'example.com' ) returns
true when no
MX, only CNAME
Status: Assigned
Type: Bug
Package: Network related
Operating System: Linux Phoenix 2.6.32
PHP Version: master-Git-2014-09-23 (snap)
Assigned To: kriscraig
Block user comment: N
Private report: N
New Comment:
You can use
phpbug68081.trueklyn.com
at present.
Previous Comments:
------------------------------------------------------------------------
[2014-09-23 04:56:15] kriscraig@php.net
Could you include the actual hostname you used? That'll make it easier for me to repro.
Thanks!
--Kris
------------------------------------------------------------------------
[2014-09-23 03:52:26] figureonecpr at gmail dot com
Description:
------------
Per http://php.net/manual/en/function.checkdnsrr.php,
checkdnsrr() defaults to an MX record query when the second argument is not supplied. Regardless of
SMTP's implicit MX logic, this function is supposed to return false if $host does
not have at least one *explicit* MX in the DNS.
However, if the supplied hostname simply has a CNAME record (a good CNAME, one that can be
dereferenced to an extant canonical hostname) the function returns true.
The bug is seen regardless of whether the canonical hostname itself has an MX record. For example,
if you have somehost.example.com CNAME --> example.com A and do checkdnsrr(
'somehost.example.com' ) you will get true. But if you go straight to the
canonical A record and do checkdnsrr( 'example.com' ) you will get false.
Test script:
---------------
// where cname.example.com exists is a CNAME in the DNS pointing to an extant canonical hostname
var_dump( checkdnsrr( 'cname.example.com' ) );
Expected result:
----------------
boolean(false)
Actual result:
--------------
boolean(true)
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=68081&edit=1