From f62c3135df230c57c5604df7b020218e1c1b777b Mon Sep 17 00:00:00 2001 From: Chirag Aggarwal Date: Thu, 3 Jul 2025 16:26:56 +0530 Subject: [PATCH] add null check for platform --- src/Appwrite/Network/Platform.php | 6 +++--- src/Appwrite/Network/Validator/Redirect.php | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/Appwrite/Network/Platform.php b/src/Appwrite/Network/Platform.php index cc59bd4508..6b18b35bef 100644 --- a/src/Appwrite/Network/Platform.php +++ b/src/Appwrite/Network/Platform.php @@ -50,10 +50,10 @@ class Platform /** * Get user-friendly platform name from a scheme. * - * @param string $scheme + * @param string|null $scheme * @return string Empty string if scheme is not found. */ - public static function getNameByScheme(string $scheme): string + public static function getNameByScheme(?string $scheme): string { return self::$names[$scheme] ?? ''; } @@ -62,7 +62,7 @@ class Platform { $hostnames = []; foreach ($platforms as $platform) { - $type = $platform['type'] ?? self::TYPE_UNKNOWN; + $type = strtolower($platform['type'] ?? self::TYPE_UNKNOWN); $hostname = strtolower($platform['hostname'] ?? ''); $key = strtolower($platform['key'] ?? ''); diff --git a/src/Appwrite/Network/Validator/Redirect.php b/src/Appwrite/Network/Validator/Redirect.php index 43750f4cbd..162f4c7eb9 100644 --- a/src/Appwrite/Network/Validator/Redirect.php +++ b/src/Appwrite/Network/Validator/Redirect.php @@ -12,7 +12,7 @@ class Redirect extends Origin */ public function getDescription(): string { - $platform = $this->scheme ? Platform::getNameByScheme($this->scheme) : null; + $platform = Platform::getNameByScheme($this->scheme); $host = $this->host ? '(' . $this->host . ')' : ''; if (empty($this->host) && empty($this->scheme)) {