Skip to content

Commit 402303a

Browse files
authored
Merge pull request #292 from maxmind/wstorey/changelog
Update changelog to mention #290
2 parents 6f9a6aa + 5f18a4a commit 402303a

2 files changed

Lines changed: 28 additions & 0 deletions

File tree

CHANGELOG.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,14 @@
11
CHANGELOG
22
=========
33

4+
3.3.1 (unreleased)
5+
------------------
6+
7+
* Updated the `GeoIp2\Model\City` constructor to handle an empty
8+
`subdivisions` array. This provides compatibility with some third-party
9+
databases that publish empty subdivisions arrays. Pull request by Jarek
10+
Jakubowski. GitHub #290.
11+
412
3.3.0 (2025-11-20)
513
------------------
614

tests/GeoIp2/Test/Model/InsightsTest.php

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -497,4 +497,24 @@ public function testMostSpecificSubdivisionWithNoSubdivisions(): void
497497
'mostSpecificSubdivision is set even on an empty response'
498498
);
499499
}
500+
501+
// We do not expect well-formed databases from MaxMind to have empty
502+
// subdivisions arrays, but we support it due to encountering a third-party
503+
// database that had them.
504+
public function testEmptySubdivisionsArray(): void
505+
{
506+
$raw = [
507+
'subdivisions' => [],
508+
'traits' => ['ip_address' => '1.1.1.1'],
509+
];
510+
511+
$model = new Insights($raw, ['en']);
512+
513+
$this->assertCount(0, $model->subdivisions);
514+
515+
$this->assertInstanceOf(
516+
'GeoIp2\Record\Subdivision',
517+
$model->mostSpecificSubdivision
518+
);
519+
}
500520
}

0 commit comments

Comments
 (0)