From f766417a339471d179325cdbe996ef2bd39f0e1a Mon Sep 17 00:00:00 2001 From: Sami Date: Mon, 25 Mar 2024 15:23:12 +0100 Subject: [PATCH] Avoid error 500 when there is an error getting publication date --- Cache/Navitia.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Cache/Navitia.php b/Cache/Navitia.php index 1a38f34..98a80cf 100644 --- a/Cache/Navitia.php +++ b/Cache/Navitia.php @@ -89,6 +89,7 @@ private function checkPublicationDate(): void if ($cacheItem->isHit()) { $publicationDateInCache = $cacheItem->get(); } + $currentPublicationDate = $this->getPublicationDate(); if ($currentPublicationDate !== null && $currentPublicationDate !== $publicationDateInCache) { @@ -127,7 +128,7 @@ public function setCacheItem(string $cacheKey, $data): void $this->cache->save($cacheItem); } - private function getPublicationDate(): string + private function getPublicationDate(): ?string { try { $url = $this->urlApi.'coverage/'.$this->coverage.'/'.self::PUBLICATION_DATE_API;