ID: 33170 Updated by: [EMAIL PROTECTED] Reported By: web at vollbrecht dot net -Status: Open +Status: Bogus Bug Type: Network related Operating System: Linux 2.6.10-1 PHP Version: 4.3.10 New Comment:
gethostbyname() is an IPv4 only function. inet_pton and inet_ntop are possible alternatives that are available in PHP 5. Previous Comments: ------------------------------------------------------------------------ [2005-05-28 13:25:15] web at vollbrecht dot net 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 this bug report at http://bugs.php.net/?id=33170&edit=1
