Bug when use chain and GeoIp2 at first position with cache
まだ誰も着手していません。
評価
調査の方向性
GeoIp2 provider の executeQuery メソッドと geocodeQuery メソッドから始め、続いて Chain::geocodeQuery が最初の provider からの空の collection と、後続の provider に対する cache の読み取りをどのように処理するかを追跡します。GeoIp2 を最初に、custom provider を 2 番目に配置した chain を再現します。GeoIp2 の空のレスポンスによって後続の provider が使用されなくなることがなくなり、意図したエラー動作が検証されれば完了です。
索引モデルが issue の本文から書いたものです。
説明
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();
- 主要言語
- PHP
- スター
- 4k
- フォーク
- 525
- 平均マージ
- 8分
- マージ済み PR(30日)
- 1
コントリビューションガイド
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
geocoder-php/Geocoder のほかの issue
-
難易度 1/5 1時間未満 初心者へのやさしさ 78/100
geocoder-php/Geocoder#1272 ·
-
question
難易度 4/5 3〜5日 初心者へのやさしさ 25/100
geocoder-php/Geocoder#1267 · コメント 2 件 ·
-
難易度 4/5 3〜5日 初心者へのやさしさ 35/100
geocoder-php/Geocoder#1266 ·
-
難易度 1/5 1時間未満 初心者へのやさしさ 38/100
geocoder-php/Geocoder#1244 · コメント 2 件 · リアクション 2 件 ·
-
provider
難易度 4/5 3〜5日 初心者へのやさしさ 30/100
geocoder-php/Geocoder#1243 ·
geocoder-php/Geocoder の issue をすべて見る
似ている issue
-
tooling
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
-
UX
難易度 2/5 1〜3時間 初心者へのやさしさ 70/100
ProfessionalWiki/NeoWiki#1525 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
-
難易度 1/5 1時間未満 初心者へのやさしさ 90/100
OpenConext/OpenConext-engineblock#2122 ·
-
Bug
難易度 2/5 1〜3時間 初心者へのやさしさ 70/100
Automattic/safe-publish#594 ·