Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make GeoIp PECL not log errors #3601

Closed
anonymous-matomo-user opened this issue Dec 9, 2012 · 4 comments
Closed

Make GeoIp PECL not log errors #3601

anonymous-matomo-user opened this issue Dec 9, 2012 · 4 comments
Labels
Task Indicates an issue is neither a feature nor a bug and it's purely a "technical" change. wontfix If you can reproduce this issue, please reopen the issue or create a new one describing it.

Comments

@anonymous-matomo-user
Copy link

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-matomo-user
Copy link
Author

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-matomo-user
Copy link
Author

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
Copy link
Member

mattab commented Dec 13, 2012

we should use a custom error handler specifically ignoring this error

@anonymous-matomo-user anonymous-matomo-user added this to the 2.x - The Great Piwik 2.x Backlog milestone Jul 8, 2014
@mattab mattab modified the milestones: Long term, Mid term Dec 5, 2016
@sgiehl
Copy link
Member

sgiehl commented Dec 21, 2018

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

@sgiehl sgiehl closed this as completed Dec 21, 2018
@sgiehl sgiehl added the wontfix If you can reproduce this issue, please reopen the issue or create a new one describing it. label Dec 21, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Task Indicates an issue is neither a feature nor a bug and it's purely a "technical" change. wontfix If you can reproduce this issue, please reopen the issue or create a new one describing it.
Projects
None yet
Development

No branches or pull requests

3 participants