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

Maxmind fails "PHP Fatal error: Cannot declare class MaxMind\Db\Reader, because the name is already in use in /Users/davetbo/Documents/MAMP_Sites/uhills.dev/wp-content/plugins/owa/modules/maxmind_geoip/includes/MaxMind-DB-Reader-php-1.0.3/src/MaxMind/Db/Reader.php on line 14" #385

Open
davetbo opened this Issue Feb 27, 2019 · 1 comment

Comments

Projects
None yet
1 participant
@davetbo
Copy link

davetbo commented Feb 27, 2019

Hello,

I am following the instructions on this page:
https://github.com/padams/Open-Web-Analytics/wiki/Maxmind-GeoIP-Module

As soon as I activate the MaxMind module in the OWA Modules config, I get this error:
PHP Fatal error: Cannot declare class MaxMind\Db\Reader, because the name is already in use in /Users/davetbo/Documents/MAMP_Sites/uhills.dev/wp-content/plugins/owa/modules/maxmind_geoip/includes/MaxMind-DB-Reader-php-1.0.3/src/MaxMind/Db/Reader.php on line 14

It looks like maybe that class is already being loaded by WordFence. If I disable WordFence it stops crashing with this error. Could you write your code to check if that class exists before instantiating it?

Best,
Dave

@davetbo

This comment has been minimized.

Copy link
Author

davetbo commented Feb 27, 2019

I created a patch for you that appears to help avoid this error. Basically it just checks if class_exists for each of the maxmind requires in your maxmind.php file.
maxmind.php.patch.txt

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.