Skip to content

Commit a2fb473

Browse files
ChristophWurstbackportbot[bot]
authored andcommitted
fix: prevent invalid return type
Signed-off-by: Christoph Wurst <[email protected]>
1 parent 0aae062 commit a2fb473

1 file changed

Lines changed: 9 additions & 1 deletion

File tree

lib/Service/Classification/PersistenceService.php

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -205,7 +205,15 @@ private function getCached(string $id): ?array {
205205
}
206206

207207
$serializedData = json_decode($json);
208-
return array_map(base64_decode(...), $serializedData);
208+
$decodedData = array_map(base64_decode(...), $serializedData);
209+
foreach ($decodedData as $decoded) {
210+
if ($decoded === false) {
211+
// Decoding failed, abort
212+
return null;
213+
}
214+
}
215+
/** @var string[] $decodedData */
216+
return $decodedData;
209217
}
210218

211219
/**

0 commit comments

Comments
 (0)