Req #76479 [NEW]: Inconsistent IPv6 handling

From: Date: Thu, 14 Jun 2018 20:13:28 +0000
Subject: Req #76479 [NEW]: Inconsistent IPv6 handling
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-215729@lists.php.net to get a copy of this message
From: Vaughn dot Frick at Ashbec dot com Operating system: Windows 10 PHP version: 7.1.18 Package: Network related Bug Type: Feature/Change Request Bug description:Inconsistent IPv6 handling Description: ------------ --- From manual page: http://www.php.net/function.gethostbyaddr --- Actually PHP 7.1.14 (not a choice above) $_SERVER['REMOTE_ADDR'] correctly returns an IPv6 address but it includes any zone ID's appended to the IPv6 address (%nn). The zone ID is needed to identify the particular NIC on that host so I would like to keep this behavior. However, if the IPv6 address including the zone ID is used with gethostbyaddr, it will fail as an invalid IPv6 address. I would prefer not having to strip the zone ID off the address as I have below. The two should be consistent. My vote is to have gethostbyaddr recognize a valid zone ID and ignore it. Test script: --------------- $visit_IP = $_SERVER['REMOTE_ADDR']; // // Strip any zone ID's off the IP address or gethostbyaddr will fail // if (stristr($visit_IP, "%")) {$visit_IP = stristr($visit_IP, "%", TRUE);} $visit_host = gethostbyaddr($visit_IP); -- Edit bug report at https://bugs.php.net/bug.php?id=76479&edit=1 -- Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=76479&r=trysnapshot54 Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=76479&r=trysnapshot55 Try a snapshot (trunk): https://bugs.php.net/fix.php?id=76479&r=trysnapshottrunk Fixed in SVN: https://bugs.php.net/fix.php?id=76479&r=fixed Fixed in release: https://bugs.php.net/fix.php?id=76479&r=alreadyfixed Need backtrace: https://bugs.php.net/fix.php?id=76479&r=needtrace Need Reproduce Script: https://bugs.php.net/fix.php?id=76479&r=needscript Try newer version: https://bugs.php.net/fix.php?id=76479&r=oldversion Not developer issue: https://bugs.php.net/fix.php?id=76479&r=support Expected behavior: https://bugs.php.net/fix.php?id=76479&r=notwrong Not enough info: https://bugs.php.net/fix.php?id=76479&r=notenoughinfo Submitted twice: https://bugs.php.net/fix.php?id=76479&r=submittedtwice register_globals: https://bugs.php.net/fix.php?id=76479&r=globals PHP 4 support discontinued: https://bugs.php.net/fix.php?id=76479&r=php4 Daylight Savings: https://bugs.php.net/fix.php?id=76479&r=dst IIS Stability: https://bugs.php.net/fix.php?id=76479&r=isapi Install GNU Sed: https://bugs.php.net/fix.php?id=76479&r=gnused Floating point limitations: https://bugs.php.net/fix.php?id=76479&r=float No Zend Extensions: https://bugs.php.net/fix.php?id=76479&r=nozend MySQL Configuration Error: https://bugs.php.net/fix.php?id=76479&r=mysqlcfg

« previous php.bugs (#215729) next »