Bug #73518 [NEW]: gethostbyaddr unnecessarily attempts to resolve the domain name back to IP addr
| From: | teo8976 at gmail dot com | Date: | Mon, 14 Nov 2016 20:32:15 +0000 |
| Subject: | Bug #73518 [NEW]: gethostbyaddr unnecessarily attempts to resolve the domain name back to IP addr | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-205371@lists.php.net to get a copy of this message | ||
From: teo8976 at gmail dot com
Operating system: linux
PHP version: 5.6.28
Package: HTTP related
Bug Type: Bug
Bug description:gethostbyaddr unnecessarily attempts to resolve the domain name back to IP addr
Description:
------------
When you call gethostbyaddr($someip), it does 2 DNS lookups:
1 - looks up the IP to find the corresponding domain name, i.e. does its
job
2 - then looks up the domain name, as if it needed to find the
corresponding IP address
The second is completely unnecessary, especially considering that, if it
times out, it nonetheless returns the host name found at step 1 (if, in
this case, it returned false or the IP address, one may perhaps argue
that it makes sense in order to verify that the host name is correct or
something).
Test script:
---------------
<?php
echo gethostbyaddr('95.232.181.106');
Expected result:
----------------
should immediately print:
host106-181-dynamic.232-95-r.retail.telecomitalia.it
At
http://mxtoolbox.com/SuperTool.aspx?action=ptr%3a95.232.181.106&run=toolpage#
you can verify that it takes a fraction of a second to do the reverse
lookup
Actual result:
--------------
From most servers, it takes more than 15 seconds (I guess it depends on
how long it takes for the DNS resolver to time out), and then it prints
the expected domain name.
Apparently, there is something wrong with this domain which prevents the
name from being resolved to an IP:
http://mxtoolbox.com/SuperTool.aspx?action=a%3ahost106-181-dynamic.232-95-r.retail.telecomitalia.it&run=toolpage
However, as explained above, the name->IP lookup is completely
unnecessary.
--
Edit bug report at https://bugs.php.net/bug.php?id=73518&edit=1
--
Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=73518&r=trysnapshot54
Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=73518&r=trysnapshot55
Try a snapshot (trunk): https://bugs.php.net/fix.php?id=73518&r=trysnapshottrunk
Fixed in SVN: https://bugs.php.net/fix.php?id=73518&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=73518&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=73518&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=73518&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=73518&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=73518&r=support
Expected behavior: https://bugs.php.net/fix.php?id=73518&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=73518&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=73518&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=73518&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=73518&r=php4
Daylight Savings: https://bugs.php.net/fix.php?id=73518&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=73518&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=73518&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=73518&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=73518&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=73518&r=mysqlcfg