File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11CHANGELOG
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+
4123.3.0 (2025-11-20)
513------------------
614
Original file line number Diff line number Diff 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}
You can’t perform that action at this time.
0 commit comments