diff --git a/src/Appwrite/Utopia/Response/Model/Project.php b/src/Appwrite/Utopia/Response/Model/Project.php index af2a21d551..c788833e88 100644 --- a/src/Appwrite/Utopia/Response/Model/Project.php +++ b/src/Appwrite/Utopia/Response/Model/Project.php @@ -94,7 +94,7 @@ class Project extends Model ->addRule('smtpPort', [ 'type' => self::TYPE_INTEGER, 'description' => 'SMTP server port', - 'default' => '', + 'default' => 0, 'example' => 25, ]) ->addRule('smtpUsername', [ @@ -225,7 +225,7 @@ class Project extends Model $document->setAttribute('smtpReplyToEmail', $smtp['replyToEmail'] ?? $smtp['replyTo'] ?? ''); // Includes backwards compatibility $document->setAttribute('smtpReplyToName', $smtp['replyToName'] ?? ''); $document->setAttribute('smtpHost', $smtp['host'] ?? ''); - $document->setAttribute('smtpPort', $smtp['port'] ?? ''); + $document->setAttribute('smtpPort', (int) ($smtp['port'] ?? 0)); $document->setAttribute('smtpUsername', $smtp['username'] ?? ''); $document->setAttribute('smtpPassword', ''); // Write-only: never expose the stored value $document->setAttribute('smtpSecure', $smtp['secure'] ?? ''); diff --git a/tests/e2e/Services/Project/ProjectConsoleClientTest.php b/tests/e2e/Services/Project/ProjectConsoleClientTest.php index a4c8b73efc..3328c7602f 100644 --- a/tests/e2e/Services/Project/ProjectConsoleClientTest.php +++ b/tests/e2e/Services/Project/ProjectConsoleClientTest.php @@ -103,7 +103,7 @@ class ProjectConsoleClientTest extends Scope $this->assertSame('', $response['body']['smtpReplyToEmail']); $this->assertSame('', $response['body']['smtpReplyToName']); $this->assertSame('', $response['body']['smtpHost']); - $this->assertSame('', $response['body']['smtpPort']); + $this->assertSame(0, $response['body']['smtpPort']); $this->assertSame('', $response['body']['smtpUsername']); $this->assertSame('', $response['body']['smtpPassword']); $this->assertSame('', $response['body']['smtpSecure']);