#39301 [Com]: ip2long returns unsigned on x86_64 (buggy RETURN_LONG?)
| From: | judas dot iscariote at gmail dot com | Date: | Mon, 30 Oct 2006 07:58:00 +0000 |
| Subject: | #39301 [Com]: ip2long returns unsigned on x86_64 (buggy RETURN_LONG?) | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-104158@lists.php.net to get a copy of this message | ||
ID: 39301
Comment by: judas dot iscariote at gmail dot com
Reported By: fly2k at bk dot ru
Status: Open
Bug Type: Network related
Operating System: N/A
PHP Version: 5.1.6
New Comment:
actually this is the expected behavior. to obtain the correct result,
to what the documentation clearly states.
use the "%u" formatter of sprintf() or printf().
http://php.net/ip2long
and then you will get the correct result both arch
Previous Comments:
------------------------------------------------------------------------
[2006-10-30 01:12:11] fly2k at bk dot ru
Description:
------------
$ip='255.255.255.254';
$iplong=ip2long($ip);
print($iplong);
Must print -2 as documented. But on x86_64 returns 4294967294.
Tried on two different hosts - one athlon64 with gentoo, other athlon64
with FC.
Reproduce code:
---------------
$ip='255.255.255.254';
$iplong=ip2long($ip);
print($iplong);
Expected result:
----------------
-2
Actual result:
--------------
4294967294
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=39301&edit=1