Skip to content

Commit a326ad4

Browse files
authored
Fixed issue with country detection
1 parent ef01012 commit a326ad4

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

Model/IpToCountryRepository.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,8 +55,8 @@ public function getCountryCode($ip)
5555
if (!$this->ipToCountry[$ip]) {
5656
$longIp = ip2long($ip);
5757
$collection = $this->ipToCountryCollectionFactory->create();
58-
$collection->addFieldToFilter('ip_from', ["gteq" => $longIp])
59-
->addFieldToFilter('ip_to', ["lteq" => $longIp])
58+
$collection->addFieldToFilter('ip_from', ["lteq" => $longIp])
59+
->addFieldToFilter('ip_to', ["gteq" => $longIp])
6060
->setPageSize(1);
6161
$ipInfo = $collection->getFirstItem();
6262
$this->ipToCountry[$ip] = $ipInfo->getCountryCode() ?: false;

0 commit comments

Comments
 (0)