Bug #66877 [NEW]: Invalid return type checkdnsrr / getmxrr
From: nschoenmaker at hostnet dot nl
Operating system: Ubuntu 13.10
PHP version: 5.5.10
Package: URL related
Bug Type: Bug
Bug description:Invalid return type checkdnsrr / getmxrr
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 bug report at https://bugs.php.net/bug.php?id=66877&edit=1
--
Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=66877&r=trysnapshot54
Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=66877&r=trysnapshot55
Try a snapshot (trunk): https://bugs.php.net/fix.php?id=66877&r=trysnapshottrunk
Fixed in SVN: https://bugs.php.net/fix.php?id=66877&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=66877&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=66877&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=66877&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=66877&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=66877&r=support
Expected behavior: https://bugs.php.net/fix.php?id=66877&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=66877&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=66877&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=66877&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=66877&r=php4
Daylight Savings: https://bugs.php.net/fix.php?id=66877&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=66877&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=66877&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=66877&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=66877&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=66877&r=mysqlcfg
Thread (4 messages)
- nschoenmaker at hostnet dot nl