Ticket #304 (closed bug: duplicate)

Opened 3 years ago

Last modified 3 years ago

bug in ip2c on 64bit machines

Reported by: Watermark Owned by: omry
Priority: Normal Milestone:
Component: IP2Country Version: 1.2
Severity: Normal Keywords:
Cc:

Description

hi,

the readInt()-funtion in ip2c.php does not work propertly on 64bit machines because the PHP-bug in the unpack-funtion on 64bit machines.

you have to change the ip2c.php file:

function readInt()
{
   $a=unpack('N', fread($this->m_file, 4));
   $b = sprintf("%b", $a[1]);
   if(strlen($b) == 64){
      $new = substr($b, 33);
      $a[1] = bindec($new);
   }
   return $a[1];
}

the idea come from: http://www.php.net/manual/en/function.unpack.php

Best wishes from Germany.

Marek Malcherek http://watermark.malcherek.com

Attachments

Change History

Changed 3 years ago by omry

  • status changed from new to closed
  • resolution set to duplicate

Thanks for the workaround, unfortunatelly its a pretty ugly hack that will cost in efficiency for everyone (not just 5.2.1 64bit users) so I will not use it. This bug effects only php 5.2.1 on 64bit systems, and I am pretty certain Zend will fix this in the next release, so I decided not to hack my way around this bug.

closing as duplicate of #264.

Changed 3 years ago by anonymous

thanks :) worx

Add/Change #304 (bug in ip2c on 64bit machines)

Author



Change Properties
<Author field>
Action
as closed
Next status will be 'reopened'
 
Note: See TracTickets for help on using tickets.