@anonymous-piwik-user opened this Issue on December 9th 2012

Hi Guys,

I never posted here before and not sure if you are aware of the issue or not.

There is a bug with GeoIP logging php errors when it encounters an unknown IP address i.e. one not in the database.

The error message is:

[client xx.x.xx.xx PHP Notice: geoip_country_code_by_name(): Host 46.6.81.70 not found in /var/www/piwik/plugins/UserCountry/LocationProvider/GeoIp/Pecl.php on line 80, referer: http://XXXXX

Solution:
/var/www/pistats/plugins/UserCountry/LocationProvider/GeoIp/Pecl.php

Line 57: $location = geoip_record_by_name($ip);

Change to:
$location = @geoip_record_by_name($ip);

The @ stops the error being logged.

Regards,

Leslie
Keywords: GeoIP logging php errors

@anonymous-piwik-user commented on December 9th 2012

Still testing error occurs as above trying line 80
From:
$result[self::COUNTRY_CODE_KEY] = geoip_country_code_by_name($ip);
To:
$result[self::COUNTRY_CODE_KEY] = @geoip_country_code_by_name($ip);

@anonymous-piwik-user commented on December 9th 2012

Confirmed.

line 80
From:
$result[self::COUNTRY_CODE_KEY] = geoip_country_code_by_name($ip);
To:
$result[self::COUNTRY_CODE_KEY] = @geoip_country_code_by_name($ip);

Stops the error being logged, I should have read the error message first it even says line 80.

@mattab commented on December 13th 2012 Member

we should use a custom error handler specifically ignoring this error

@sgiehl commented on December 21st 2018 Member

As GeoIp is deprecated meanwhile, we not likely will change that anymore, but enforce user to use GeoIP2 instead.

This Issue was closed on December 21st 2018
Powered by GitHub Issue Mirror