From: [EMAIL PROTECTED]
Operating system: Debian 3.0 / Kernel 2.4.18
PHP version: 4.2.0
PHP Bug Type: Network related
Bug description: long2ip problems with unsigned double
When storing ips as unsigned doubles I noticed a strange behaviour when
passing unsigned doubles through the long2ip routine.
-- sample --
<?php
$ip = ip2long("192.168.0.1");
print long2ip($ip)."\n";
if ($ip < 0) $ip+=pow(2,32); //convert from signed to unsigned
print long2ip($ip)."\n";
?>
-- end ---
In the first line - as supposed - the script returns "192.168.0.1", but
after conversion I get an offset by one and it returns "192.168.0.0". I
read in the doc that long2ip is capable of handling both signed and
unsigned long integers.
Peter
--
Edit bug report at http://bugs.php.net/?id=17202&edit=1
--
Fixed in CVS: http://bugs.php.net/fix.php?id=17202&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=17202&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=17202&r=needtrace
Try newer version: http://bugs.php.net/fix.php?id=17202&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=17202&r=support
Expected behavior: http://bugs.php.net/fix.php?id=17202&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=17202&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=17202&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=17202&r=globals