Skip to content

Commit 172de5e

Browse files
fix: prevent invalid return type
Signed-off-by: Christoph Wurst <[email protected]>
1 parent 178b080 commit 172de5e

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

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)