ID: 8217 Updated by: [EMAIL PROTECTED] Reported By: [EMAIL PROTECTED] -Status: Open +Status: Closed Bug Type: Feature/Change Request Operating System: Linux PHP Version: 4.0.3pl1 New Comment:
Thank you for your bug report. This issue has already been fixed in the latest released version of PHP, which you can download at http://www.php.net/downloads.php Previous Comments: ------------------------------------------------------------------------ [2000-12-13 06:35:01] [EMAIL PROTECTED] Numbers you brought are not valid PHP longs, they don't fit signed long. So they don't give good result in long2ip. It might be done with a special hack, but it's not a bug - it's a lacking feature. ------------------------------------------------------------------------ [2000-12-12 18:43:49] [EMAIL PROTECTED] Feed the following list to this script and you will see how long2ip screws up. There is an overflow condition it seems: 178519801 1061963075 1070665698 1070668067 2180645450 2180645574 2180645666 2180645722 2180647266 2180648705 2180649062 2180652350 2180676205 2301042637 2554268534 2554278550 2554279006 3232238083 3232238334 3435825182 3435825736 3475085569 3506496261 3508072161 3522432302 3528459286 3528470646 3528471070 <?php function lng2ip($ip) { settype($ip,"double"); return floor($ip/(256*256*256)) . "." . floor($ip/(256*256))%256 . "." . floor($ip/256)%256 . "." . } $fh=fopen("xx","r"); while ($x=fgets($fh,100)) { $x=rtrim ($x); echo "$x ".long2ip($x)." ".lng2ip($x)."\n"; } ?> ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=8217&edit=1
