geocoder-php / GeocoderLaravel

Geocoder service provider for Laravel
http://geocoder-php.org/GeocoderLaravel/
MIT License
706 stars 102 forks source link

Default cache duration #107

Closed michael-vostrikov closed 7 years ago

michael-vostrikov commented 7 years ago

General Information

GeocoderLaravel Version: 4.0.2 Laravel Version: 5.4.28 PHP Version: PHP 7.1.1 (ZTS MSVC14 (Visual C++ 2015) x86)

Issue Description

Default value for 999999999 for cache-duration causes that results are not cached with 32-bit PHP. This happens because Laravel has the check (int) ($duration * 60) > 0 ? $duration : null in the method Illuminate\Cache\Repository::getMinutes(). For 999999999 on 32-bit systems it causes a truncation, and the result becomes less that zero. https://github.com/laravel/framework/blob/5.4/src/Illuminate/Cache/Repository.php#L486

The solution can be to change the value to 9999999 or at least add a warning to config file and docs.

Steps to Replicate

Install toin0u/geocoder-laravel with 32-bit PHP. Run php artisan vendor:publish --provider="Geocoder\Laravel\Providers\GeocoderService" --tag="config" Check if results are cached.

mikebronner commented 7 years ago

Thanks @michael-vostrikov , excellent catch! I will get this fixed ASAP.