From 172de5e3445b8be9b06ab118e9ebdf6e84a8a21c Mon Sep 17 00:00:00 2001 From: Christoph Wurst Date: Wed, 4 Jun 2025 08:36:42 +0200 Subject: [PATCH] fix: prevent invalid return type Signed-off-by: Christoph Wurst --- lib/Service/Classification/PersistenceService.php | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/lib/Service/Classification/PersistenceService.php b/lib/Service/Classification/PersistenceService.php index ccfb40b0ff..8c1e2c79ba 100644 --- a/lib/Service/Classification/PersistenceService.php +++ b/lib/Service/Classification/PersistenceService.php @@ -205,7 +205,15 @@ private function getCached(string $id): ?array { } $serializedData = json_decode($json); - return array_map(base64_decode(...), $serializedData); + $decodedData = array_map(base64_decode(...), $serializedData); + foreach ($decodedData as $decoded) { + if ($decoded === false) { + // Decoding failed, abort + return null; + } + } + /** @var string[] $decodedData */ + return $decodedData; } /**