PEAR is discontinued

This is a static archive preserving historical releases and metadata. No new packages or updates will be published. For updates to existing packages, or to publish new packages, please use Composer and Packagist.

Home » Networking » Net_GeoIP » Bug #10198

method lookupCountryId throws exception on valid IP

Details

Submitted2007-02-26 21:23 UTC
Fromdavetay1021 at gmail dot com
StatusBogus
PackageNet_GeoIP
PHP Version5.2.0
OSCentOS 4.4
Roadmaps(Not assigned)

Comments

[2007-02-26 21:23 UTC] davetay1021 at gmail dot com

Description:
------------
The method lookupCountryId throws an exception on line 540 stating that the given IP is invalid, even on valid IPs. The method excepts 1 parameter, a string, the IP address. It looks like the parameter being passed into this method is an array ("ip" => '0.0.0.0').

Changing line 538 from "$ipnum = ip2long($addr);" to "$ipnum = ip2long($addr['ip']);" takes care of the problem.

[2007-02-26 21:47 UTC] hlellelid at php dot net

Please note that the lookupCountryCode() method expects to be passed a valid IP address. If you are passing an array ("ip" => "0.0.0.0") into this method, it will fail. I.e. this sounds like a problem with the way you are calling a method in the library.