Bug #66877 [Opn]: Invalid return value checkdnsrr / getmxrr

From: Date: Mon, 10 Mar 2014 11:41:03 +0000
Subject: Bug #66877 [Opn]: Invalid return value checkdnsrr / getmxrr
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-184687@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=66877&edit=1

 ID:                 66877
 User updated by:    nschoenmaker at hostnet dot nl
 Reported by:        nschoenmaker at hostnet dot nl
-Summary:            Invalid return type checkdnsrr / getmxrr
+Summary:            Invalid return value checkdnsrr / getmxrr
 Status:             Open
 Type:               Bug
 Package:            URL related
 Operating System:   Ubuntu 13.10
 PHP Version:        5.5.10
 Block user comment: N
 Private report:     N

 New Comment:

The return value is incorrect, not the return type.


Previous Comments:
------------------------------------------------------------------------
[2014-03-10 11:35:32] nschoenmaker at hostnet dot nl

Description:
------------
The return type of checkdnsrr and getmxrr are described as: Returns TRUE if any records are found;
returns FALSE if no records were found or if an error occurred.

So if we check for a non-existant domain name, the result should be false.

The following command gives the expected result on my system, empty:
dig +short non-existant-domain-name.com MX

Bug found using Zend server 6.3, which is released with PHP 5.5.7. Also confirmed for current
master.

Related to (closed) bug https://bugs.php.net/bug.php?id=8264

Test script:
---------------
Two test scripts:

php -r 'var_dump(checkdnsrr("non-existant-domain-name.com"));'
  bool(true)

php -r
'var_dump(getmxrr("non-existant-domain-name.com",$mxhosts));var_dump($mxhosts);'
  bool(true)
  array(0) {
  }


Expected result:
----------------
I would expect checkdnsrr("non-existant-domain-name.com") and
getmxrr("non-existant-domain-name.com",$a) to return false.

Actual result:
--------------
They return true.

The case of getmxrr() is even stranger, this is the description of the meaning of the second
parameter:
    A list of the MX records found is placed into the array mxhosts.

This list is empty! So the return type indicates there are records, but the second in/out argument
indicates there are no records...


------------------------------------------------------------------------



-- 
Edit this bug report at https://bugs.php.net/bug.php?id=66877&edit=1


Thread (4 messages)

« previous php.bugs (#184687) next »