json_decode: always throw on error and fix other psalm issues

Signed-off-by: Simon L. <szaimen@e.mail.de>
This commit is contained in:
Simon L. 2025-11-05 12:33:07 +01:00
parent df0f7b8d85
commit 6f945a2369
6 changed files with 19 additions and 23 deletions

View file

@ -636,7 +636,7 @@ class ConfigurationManager
return "";
}
return trim(file_get_contents(DataConst::GetBackupPublicKey()));
return trim((string)file_get_contents(DataConst::GetBackupPublicKey()));
}
public function GetBorgRestorePassword() : string {
@ -1040,7 +1040,7 @@ class ConfigurationManager
apcu_add($filePath, $fileContents);
}
}
$json = is_string($fileContents) ? json_decode($fileContents, true) : false;
$json = is_string($fileContents) ? json_decode($fileContents, true, 512, JSON_THROW_ON_ERROR) : false;
if(is_array($json) && is_array($json['aio_services_v1'])) {
foreach ($json['aio_services_v1'] as $service) {
$documentation = is_string($service['documentation']) ? $service['documentation'] : '';