diff --git a/3rdparty b/3rdparty index f87dc48712..03c3c48ab0 160000 --- a/3rdparty +++ b/3rdparty @@ -1 +1 @@ -Subproject commit f87dc487126897af8251c2d65eb5b51cb62430f7 +Subproject commit 03c3c48ab0dfe4bb126704109691b5f995e67780 diff --git a/lib/Service/GeoIp/GeoIpDatabaseStatusService.php b/lib/Service/GeoIp/GeoIpDatabaseStatusService.php index fd32a0c7d4..46a0412892 100644 --- a/lib/Service/GeoIp/GeoIpDatabaseStatusService.php +++ b/lib/Service/GeoIp/GeoIpDatabaseStatusService.php @@ -73,7 +73,10 @@ public function getStatus(): array { $metadata = $reader->metadata(); $databaseType = $metadata->databaseType; $payload['databaseType'] = $databaseType; - $payload['buildEpoch'] = $metadata->buildEpoch; + $buildEpoch = filter_var($metadata->buildEpoch, FILTER_VALIDATE_INT, ['options' => ['min_range' => 0]]); + if (is_int($buildEpoch)) { + $payload['buildEpoch'] = $buildEpoch; + } if (!$this->isSupportedDatabaseType($databaseType)) { $payload['status'] = GeoIpDatabaseStatus::UNSUPPORTED_DATABASE->value; diff --git a/tests/php/Unit/Service/GeoIp/GeoIpDatabaseStatusServiceTest.php b/tests/php/Unit/Service/GeoIp/GeoIpDatabaseStatusServiceTest.php index c69b28820e..996a4a8d1b 100644 --- a/tests/php/Unit/Service/GeoIp/GeoIpDatabaseStatusServiceTest.php +++ b/tests/php/Unit/Service/GeoIp/GeoIpDatabaseStatusServiceTest.php @@ -55,7 +55,7 @@ public function testReadyWithMaxMindTestFixture(): void { $this->assertSame(GeoIpDatabaseStatus::READY->value, $status['status']); $this->assertSame($path, $status['path']); $this->assertSame('GeoIP2-City', $status['databaseType'] ?? null); - $this->assertArrayHasKey('buildEpoch', $status); + $this->assertSame(1770245369, $status['buildEpoch'] ?? null); $this->assertArrayHasKey('modifiedAt', $status); $this->assertTrue($this->getService()->isReady()); }