From 49ba7d5dfde8c87bf8747cd51c00275b9375a5fe Mon Sep 17 00:00:00 2001 From: Torsten Dittmann Date: Tue, 28 Dec 2021 11:48:50 +0100 Subject: [PATCH] fix: users prefs default value --- app/config/collections.php | 2 +- app/controllers/api/account.php | 8 ++++---- app/controllers/api/teams.php | 2 +- app/controllers/api/users.php | 2 +- src/Appwrite/Migration/Version/V11.php | 2 +- 5 files changed, 8 insertions(+), 8 deletions(-) diff --git a/app/config/collections.php b/app/config/collections.php index cde64ae385..6c517b34a0 100644 --- a/app/config/collections.php +++ b/app/config/collections.php @@ -1001,7 +1001,7 @@ $collections = [ 'size' => 16384, 'signed' => true, 'required' => false, - 'default' => [], + 'default' => new \stdClass(), 'array' => false, 'filters' => ['json'], ], diff --git a/app/controllers/api/account.php b/app/controllers/api/account.php index e3d951e861..ef00af00e0 100644 --- a/app/controllers/api/account.php +++ b/app/controllers/api/account.php @@ -102,7 +102,7 @@ App::post('/v1/account') 'registration' => \time(), 'reset' => false, 'name' => $name, - 'prefs' => [], + 'prefs' => new \stdClass(), 'sessions' => [], 'tokens' => [], 'memberships' => [], @@ -500,7 +500,7 @@ App::get('/v1/account/sessions/oauth2/:provider/redirect') 'registration' => \time(), 'reset' => false, 'name' => $name, - 'prefs' => [], + 'prefs' => new \stdClass(), 'sessions' => [], 'tokens' => [], 'memberships' => [], @@ -672,7 +672,7 @@ App::post('/v1/account/sessions/magic-url') 'passwordUpdate' => \time(), 'registration' => \time(), 'reset' => false, - 'prefs' => [], + 'prefs' => new \stdClass(), 'sessions' => [], 'tokens' => [], 'memberships' => [], @@ -944,7 +944,7 @@ App::post('/v1/account/sessions/anonymous') 'registration' => \time(), 'reset' => false, 'name' => null, - 'prefs' => [], + 'prefs' => new \stdClass(), 'sessions' => [], 'tokens' => [], 'memberships' => [], diff --git a/app/controllers/api/teams.php b/app/controllers/api/teams.php index 20bed66f53..c2f26159b5 100644 --- a/app/controllers/api/teams.php +++ b/app/controllers/api/teams.php @@ -333,7 +333,7 @@ App::post('/v1/teams/:teamId/memberships') 'registration' => \time(), 'reset' => false, 'name' => $name, - 'prefs' => [], + 'prefs' => new \stdClass(), 'sessions' => [], 'tokens' => [], 'memberships' => [], diff --git a/app/controllers/api/users.php b/app/controllers/api/users.php index a55a585384..61a9e24a41 100644 --- a/app/controllers/api/users.php +++ b/app/controllers/api/users.php @@ -62,7 +62,7 @@ App::post('/v1/users') 'registration' => \time(), 'reset' => false, 'name' => $name, - 'prefs' => [], + 'prefs' => new \stdClass(), 'sessions' => [], 'tokens' => [], 'memberships' => [], diff --git a/src/Appwrite/Migration/Version/V11.php b/src/Appwrite/Migration/Version/V11.php index d8b554d3a7..81d2ddb48a 100644 --- a/src/Appwrite/Migration/Version/V11.php +++ b/src/Appwrite/Migration/Version/V11.php @@ -514,7 +514,7 @@ class V11 extends Migration * Set default values for arrays if not set. */ if (empty($document->getAttribute('prefs', []))) { - $document->setAttribute('prefs', []); + $document->setAttribute('prefs', new \stdClass()); } if (empty($document->getAttribute('sessions', []))) { $document->setAttribute('sessions', []);