From: Ferdinand Thiessen Date: Wed, 23 Oct 2024 10:57:29 +0000 (+0200) Subject: fix(app-store): Ensure the `groups` property is always an array X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=refs%2Fheads%2Frefactor%2Fappstore-modernization;p=nextcloud-server.git fix(app-store): Ensure the `groups` property is always an array If the value was a string, like a single group, then `json_decode` will also yield only a string. So in this case we ensure the property is always an array with that value. Signed-off-by: Ferdinand Thiessen --- diff --git a/apps/settings/lib/Controller/AppSettingsController.php b/apps/settings/lib/Controller/AppSettingsController.php index f50338c3923..b227d815597 100644 --- a/apps/settings/lib/Controller/AppSettingsController.php +++ b/apps/settings/lib/Controller/AppSettingsController.php @@ -317,6 +317,10 @@ class AppSettingsController extends Controller { $groups = []; if (is_string($appData['groups'])) { $groups = json_decode($appData['groups']); + // ensure 'groups' is an array + if (!is_array($groups)) { + $groups = [$groups]; + } } $appData['groups'] = $groups;