#33170 [NEW]: IPv6: gethostbyname() fails on resolving IPv6 hostnames
From: web at vollbrecht dot net
Operating system: Linux 2.6.10-1
PHP version: 4.3.10
PHP Bug Type: Network related
Bug description: IPv6: gethostbyname() fails on resolving IPv6 hostnames
Description:
------------
perhaps related to #12678.
gethostbyname() gives the IPv6 hostname back instead if the IPv6 ip. In
IPv4 everything works fine.
Note: IPs and hostnames in the following snipplets are replaced with
example entries. It was tested with working IPs both in IPv4 and IPv6.
Reproduce code:
---------------
$client_ip = $_SERVER["REMOTE_ADDR"];
$client_hostname = gethostbyaddr($_SERVER["REMOTE_ADDR"]);
$client_hostname2ip =
gethostbyname(gethostbyaddr($_SERVER["REMOTE_ADDR"]));
echo $client_ip."->".$client_hostname."->".$client_hostname2ip;
Expected result:
----------------
In IPv4:
10.11.12.13->server.domain.de->10.11.12.13
In IPv6:
3ffe:1::1->server.ipv6.domain.de->3ffe:1::1
Actual result:
--------------
In IPv4 (working fine): 10.11.12.13->server.domain.de->10.11.12.13
In IPv6 (last output broken):
3ffe:1::1->server.ipv6.domain.de->server.ipv6.domain.de
--
Edit bug report at http://bugs.php.net/?id=33170&edit=1
--
Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=33170&r=trysnapshot4
Try a CVS snapshot (php5.0): http://bugs.php.net/fix.php?id=33170&r=trysnapshot50
Try a CVS snapshot (php5.1): http://bugs.php.net/fix.php?id=33170&r=trysnapshot51
Fixed in CVS: http://bugs.php.net/fix.php?id=33170&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=33170&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=33170&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=33170&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=33170&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=33170&r=support
Expected behavior: http://bugs.php.net/fix.php?id=33170&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=33170&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=33170&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=33170&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=33170&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=33170&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=33170&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=33170&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=33170&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=33170&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=33170&r=mysqlcfg
Thread (2 messages)
- web at vollbrecht dot net