Torann / laravel-geoip

Determine the geographical location of website visitors based on their IP addresses.
http://lyften.com/projects/laravel-geoip
BSD 2-Clause "Simplified" License
2.09k stars 372 forks source link

Added support for ipdata.co #117

Closed janicerar closed 5 years ago

bastones commented 5 years ago

@janicerar

It's great how you're passing the entire API response directly to $this->hydrate(). This particular API returns a currency key as an array with a sub key labelled code which contains the ISO code that we actually need.

The GeoIP class only checks whether the currency key is empty before passing the entire contents of that key to GeoIP::getCurrency(), causing the following error to be thrown after the currency is incorrectly cached as an array instead of a string:

strtoupper() expects parameter 1 to be string, array given

You've committed sloppy work. Compare this to the IPApi class in which the author is carefully transforming the array keys returned by the API with the array keys in which GeoIP expects.

I'm quite pissed off right now because you've wasted 1 hour of my time and now I need to submit a PR to fix your code.

Torann commented 5 years ago

@bastones I'm releasing a fix for this now

bastones commented 5 years ago

@Torann Thank you