Req #67601 [Com]: ip2long(), or a successor needs to support IPv6
| From: | spam2 at rhsoft dot net | Date: | Mon, 26 Jun 2017 22:07:17 +0000 |
| Subject: | Req #67601 [Com]: ip2long(), or a successor needs to support IPv6 | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-209693@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=67601&edit=1
ID: 67601
Comment by: spam2 at rhsoft dot net
Reported by: gem at rellim dot com
Summary: ip2long(), or a successor needs to support IPv6
Status: Open
Type: Feature/Change Request
Package: *Network Functions
Operating System: any
PHP Version: 5.5.14
Block user comment: N
Private report: N
New Comment:
> get back to me when PHP_INT_MAX returns 170141183460469231731687303715884105727
that's ridiculous at it's own on modern hardware and a weak excuse
Previous Comments:
------------------------------------------------------------------------
[2017-06-26 22:04:39] jc at unternet dot net
"PHP needs to support ipv6 without userland code needs to know about it at all - period"
get back to me when PHP_INT_MAX returns 170141183460469231731687303715884105727
------------------------------------------------------------------------
[2017-06-26 19:41:50] gem at rellim dot com
"in 2017 PHP needs to support ipv6 without userland code needs to know about it at all -
period"
+1
------------------------------------------------------------------------
[2017-06-26 19:30:29] spam2 at rhsoft dot net
besides of RFC and what not - "for an easy workaround:
gmp_import(inet_pton($ip));" is crap - in 2017 PHP needs to support ipv6 without
userland code needs to know about it at all - period
------------------------------------------------------------------------
[2017-06-26 19:27:31] jc at unternet dot net
new features require approved RFC as per https://github.com/php/php-src/
128 bits cannot fit into a long int anyway, assuming "long" is defined as 64 bits. see https://stackoverflow.com/a/37250452/493161
for an easy workaround: gmp_import(inet_pton($ip));
I vote to close.
------------------------------------------------------------------------
[2014-07-10 01:52:55] gem at rellim dot com
Description:
------------
Currently ip2long() on works on some IP addresses: IPv4 addresses, not IPv6 addresses.
I would like it, or an ip2long-ng(), to also support IPv6 addresses.
Test script:
---------------
<?php
print_r( ip2long( '2607:400:0:1f3::1:6'));
Expected result:
----------------
The results should be something like:
0x26070400000001f30000000000010006
Actual result:
--------------
FALSE, since it is invalid IPv4 address, but is a valid IP address
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=67601&edit=1