Open
Description
GeoIp2 return empty collection and save it in cache after that next providers(custom) load from cache empty collection instead of using his code
$result = json_decode($this->executeQuery($address));
if (null === $result) {
return new AddressCollection([]);
}
$result = json_decode(''); //NULL
private function executeQuery(string $address): string
{
$uri = sprintf('file://geoip?%s', $address);
try {
$result = $this->adapter->getContent($uri);
} catch (AddressNotFoundException $e) {
return '';
} catch (AuthenticationException $e) {
throw new InvalidCredentials(
$e->getMessage(),
$e->getCode(),
$e
);
} catch (OutOfQueriesException $e) {
throw new QuotaExceeded(
$e->getMessage(),
$e->getCode(),
$e
);
}
return $result;
}
I think there should not be return '';, but there should be fatal
public function geocodeQuery(GeocodeQuery $query): Collection
{
foreach ($this->providers as $provider) {
try {
$result = $provider->geocodeQuery($query);
if (!$result->isEmpty()) {
return $result;
}
} catch (\Throwable $e) {
$this->log(
'alert',
sprintf('Provider "%s" could geocode address: "%s".', $provider->getName(), $query->getText()),
['exception' => $e]
);
}
}
return new AddressCollection();
}
\Geocoder\Provider\Chain\Chain::geocodeQuery now always return empty collectioon \Geocoder\Model\AddressCollection();