Skip to content
This repository has been archived by the owner on Jun 1, 2022. It is now read-only.

Commit

Permalink
Merge pull request #35 from maxmind/greg/fix-exact-false-check
Browse files Browse the repository at this point in the history
Do not use false-y value as an object. Closes  #34.
  • Loading branch information
2shortplanks committed Jan 29, 2016
2 parents 7566233 + 48dcb95 commit 56134ce
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/geoip.inc
Original file line number Diff line number Diff line change
Expand Up @@ -1635,7 +1635,7 @@ function geoip_country_code_by_addr($gi, $addr)
{
if ($gi->databaseType == GEOIP_CITY_EDITION_REV1) {
$record = geoip_record_by_addr($gi, $addr);
if ($record !== false) {
if ($record) {
return $record->country_code;
}
} else {
Expand Down
5 changes: 5 additions & 0 deletions tests/CityTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,5 +30,10 @@ public function testCity()
'America/Los_Angeles',
get_time_zone($record->country_code, $record->region)
);

$this->assertEquals(
'US',
geoip_country_code_by_addr($gi, "64.17.254.216")
);
}
}

0 comments on commit 56134ce

Please sign in to comment.