Skip to content

Commit 5b83335

Browse files
committed
An update to the MDQ PR #2200 (#2203)
1 parent 30662b3 commit 5b83335

1 file changed

Lines changed: 2 additions & 3 deletions

File tree

  • src/SimpleSAML/Metadata/Sources

src/SimpleSAML/Metadata/Sources/MDQ.php

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -184,7 +184,7 @@ private function getFromCache(string $set, string $entityId): ?array
184184
}
185185

186186
// ensure json is decoded as an associative array not an object
187-
$data = json_decode($rawData, true);
187+
$data = json_decode($rawData, true, 512, JSON_THROW_ON_ERROR);
188188
if ($data === false) {
189189
throw new Exception(
190190
sprintf('%s: error unserializing cached data from file "%s".', __CLASS__, strval($file)),
@@ -218,8 +218,7 @@ private function writeToCache(string $set, string $entityId, array $data): void
218218

219219
Logger::debug(sprintf('%s: Writing cache [%s] => [%s]', __CLASS__, $entityId, $cacheFileName));
220220

221-
// using dumpFile instead of appendToFile here to replace any existing cache data
222-
$this->fileSystem->dumpFile($cacheFileName, json_encode($data));
221+
$this->fileSystem->dumpFile($cacheFileName, json_encode($data, JSON_THROW_ON_ERROR));
223222
}
224223

225224

0 commit comments

Comments
 (0)