diff --git a/app/controllers/api/avatars.php b/app/controllers/api/avatars.php index b6395774e9..0ac1cee056 100644 --- a/app/controllers/api/avatars.php +++ b/app/controllers/api/avatars.php @@ -521,7 +521,7 @@ App::get('/v1/avatars/initials') // if there is no space, try to split by `_` underscore $words = (count($words) == 1) ? \explode('_', \strtoupper($name)) : $words; - $initials = null; + $initials = ''; $code = 0; foreach ($words as $key => $w) { diff --git a/app/controllers/api/databases.php b/app/controllers/api/databases.php index b3104f6736..8b44dfe720 100644 --- a/app/controllers/api/databases.php +++ b/app/controllers/api/databases.php @@ -3934,7 +3934,7 @@ App::get('/v1/databases/:databaseId/collections/:collectionId/usage') }; $stats[$metric][] = [ 'value' => 0, - 'date' => DateTime::formatTz(DateTime::addSeconds(new \DateTime($stats[$metric][$last]['date'] ?? null), -1 * $diff)), + 'date' => DateTime::formatTz(DateTime::addSeconds(new \DateTime($stats[$metric][$last]['date'] ?? 'now'), -1 * $diff)), ]; $backfill--; } diff --git a/app/controllers/api/projects.php b/app/controllers/api/projects.php index 4e13747a50..fe4a32dec9 100644 --- a/app/controllers/api/projects.php +++ b/app/controllers/api/projects.php @@ -385,7 +385,7 @@ App::get('/v1/projects/:projectId/usage') }; $stats[$metric][] = [ 'value' => 0, - 'date' => DateTime::formatTz(DateTime::addSeconds(new \DateTime($stats[$metric][$last]['date'] ?? null), -1 * $diff)), + 'date' => DateTime::formatTz(DateTime::addSeconds(new \DateTime($stats[$metric][$last]['date'] ?? 'now'), -1 * $diff)), ]; $backfill--; } diff --git a/app/controllers/api/users.php b/app/controllers/api/users.php index e090b32300..1d12d62b33 100644 --- a/app/controllers/api/users.php +++ b/app/controllers/api/users.php @@ -1844,7 +1844,7 @@ App::get('/v1/users/usage') }; $stats[$metric][] = [ 'value' => 0, - 'date' => DateTime::formatTz(DateTime::addSeconds(new \DateTime($stats[$metric][$last]['date'] ?? null), -1 * $diff)), + 'date' => DateTime::formatTz(DateTime::addSeconds(new \DateTime($stats[$metric][$last]['date'] ?? 'now'), -1 * $diff)), ]; $backfill--; } diff --git a/src/Appwrite/Auth/Hash/Scryptmodified.php b/src/Appwrite/Auth/Hash/Scryptmodified.php index 2d1cd4f165..7717f324e5 100644 --- a/src/Appwrite/Auth/Hash/Scryptmodified.php +++ b/src/Appwrite/Auth/Hash/Scryptmodified.php @@ -60,7 +60,8 @@ class Scryptmodified extends Hash $saltBytes = \base64_decode($options['salt']); $saltSeparatorBytes = \base64_decode($options['saltSeparator']); - $derivedKey = \scrypt(\utf8_encode($password), $saltBytes . $saltSeparatorBytes, 16384, 8, 1, 64); + $password = mb_convert_encoding($password, 'UTF-8'); + $derivedKey = \scrypt($password, $saltBytes . $saltSeparatorBytes, 16384, 8, 1, 64); $derivedKey = \hex2bin($derivedKey); return $derivedKey; diff --git a/src/Appwrite/Auth/Validator/PersonalData.php b/src/Appwrite/Auth/Validator/PersonalData.php index 6f8ed0a8c9..f93945755c 100644 --- a/src/Appwrite/Auth/Validator/PersonalData.php +++ b/src/Appwrite/Auth/Validator/PersonalData.php @@ -43,10 +43,10 @@ class PersonalData extends Password if (!$this->strict) { $password = strtolower($password); - $this->userId = strtolower($this->userId); - $this->email = strtolower($this->email); - $this->name = strtolower($this->name); - $this->phone = strtolower($this->phone); + $this->userId = strtolower($this->userId ?? ''); + $this->email = strtolower($this->email ?? ''); + $this->name = strtolower($this->name ?? ''); + $this->phone = strtolower($this->phone ?? ''); } if ($this->userId && strpos($password, $this->userId) !== false) {