geoip.inc is breaking when geoip_* functions are already defined #9855
Labels
Bug
For errors / faults / flaws / inconsistencies etc.
not-in-changelog
For issues or pull requests that should not be included in our release changelog on matomo.org.
Milestone
Abstract
/libs/MaxMindGeoIP/geoip.inc
isn't checking whether all functions that it implements in thegeoip_*
namespace already exist. This can lead to fatal errors in Piwik when a non-default version ofgeoip.so
is installed on the server.Solution
Every
geoip_*
function defined in this file should be surrounded by a check for existence, like some of them already have them.Example
We've recently upgraded our production environment to PHP7, using Ondřej Surý's excellent PPA for PHP7 in Ubuntu. But as the official
geoip
extension hasn't been ported to PHP7 yet, we had to compile some fork that has this support enabled. The best choice seemed to be @Zakays fork (https://github.com/Zakay/geoip) and it worked fine for our needs. This extension also implements some functions in thegeoip_*
namespace that aren't available in the default PHP5 extension, but are defined in the aforementionedgeoip.inc
file, which leads to an error like:The text was updated successfully, but these errors were encountered: