From 99c09607c6dfd5d151caa3f4a05ff33370b1d03e Mon Sep 17 00:00:00 2001 From: Jana Peper Date: Thu, 12 Dec 2024 15:47:01 +0100 Subject: [PATCH] feat: add error flags for json_decode Signed-off-by: Jana Peper --- apps/settings/lib/Settings/Admin/ArtificialIntelligence.php | 2 +- lib/private/TaskProcessing/Manager.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/apps/settings/lib/Settings/Admin/ArtificialIntelligence.php b/apps/settings/lib/Settings/Admin/ArtificialIntelligence.php index c606963536715..a7e5276762d11 100644 --- a/apps/settings/lib/Settings/Admin/ArtificialIntelligence.php +++ b/apps/settings/lib/Settings/Admin/ArtificialIntelligence.php @@ -143,7 +143,7 @@ public function getForm() { $value = $defaultValue; $json = $this->config->getAppValue('core', $key, ''); if ($json !== '') { - $value = json_decode($json, true); + $value = json_decode($json, true, flags: JSON_THROW_ON_ERROR); switch ($key) { case 'ai.taskprocessing_provider_preferences': case 'ai.taskprocessing_type_preferences': diff --git a/lib/private/TaskProcessing/Manager.php b/lib/private/TaskProcessing/Manager.php index e263195d35ea1..8afc62a05d4b6 100644 --- a/lib/private/TaskProcessing/Manager.php +++ b/lib/private/TaskProcessing/Manager.php @@ -572,7 +572,7 @@ private function _getTaskTypeSettings(): array { if ($json === '') { return []; } - return json_decode($json, true); + return json_decode($json, true, flags: JSON_THROW_ON_ERROR); } /**