Skip to content

Commit dc0a3de

Browse files
committed
fix: handle missing and empty provider option keys safely
1 parent fd4c95c commit dc0a3de

1 file changed

Lines changed: 23 additions & 23 deletions

File tree

src/Migration/Destinations/Appwrite.php

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1610,50 +1610,50 @@ protected function createProvider(Provider $resource): bool
16101610
$credentials['apiKey'] ?? null,
16111611
$credentials['domain'] ?? null,
16121612
$credentials['isEuRegion'] ?? null,
1613-
$options['fromName'] ?: null,
1614-
$options['fromEmail'] ?: null,
1615-
$options['replyToName'] ?: null,
1616-
$options['replyToEmail'] ?: null,
1613+
($options['fromName'] ?? '') ?: null,
1614+
($options['fromEmail'] ?? '') ?: null,
1615+
($options['replyToName'] ?? '') ?: null,
1616+
($options['replyToEmail'] ?? '') ?: null,
16171617
$enabled,
16181618
),
16191619
'sendgrid' => $this->messaging->createSendgridProvider(
16201620
$id,
16211621
$name,
16221622
$credentials['apiKey'] ?? null,
1623-
$options['fromName'] ?: null,
1624-
$options['fromEmail'] ?: null,
1625-
$options['replyToName'] ?: null,
1626-
$options['replyToEmail'] ?: null,
1623+
($options['fromName'] ?? '') ?: null,
1624+
($options['fromEmail'] ?? '') ?: null,
1625+
($options['replyToName'] ?? '') ?: null,
1626+
($options['replyToEmail'] ?? '') ?: null,
16271627
$enabled,
16281628
),
16291629
'resend' => $this->messaging->createResendProvider(
16301630
$id,
16311631
$name,
16321632
$credentials['apiKey'] ?? null,
1633-
$options['fromName'] ?: null,
1634-
$options['fromEmail'] ?: null,
1635-
$options['replyToName'] ?: null,
1636-
$options['replyToEmail'] ?: null,
1633+
($options['fromName'] ?? '') ?: null,
1634+
($options['fromEmail'] ?? '') ?: null,
1635+
($options['replyToName'] ?? '') ?: null,
1636+
($options['replyToEmail'] ?? '') ?: null,
16371637
$enabled,
16381638
),
16391639
'smtp' => $this->messaging->createSMTPProvider(
16401640
$id,
16411641
$name,
16421642
$credentials['host'] ?? '',
16431643
$credentials['port'] ?? null,
1644-
$credentials['username'] ?: null,
1645-
$credentials['password'] ?: null,
1644+
($credentials['username'] ?? '') ?: null,
1645+
($credentials['password'] ?? '') ?: null,
16461646
match ($options['encryption'] ?? '') {
16471647
'ssl' => SmtpEncryption::SSL(),
16481648
'tls' => SmtpEncryption::TLS(),
16491649
default => SmtpEncryption::NONE(),
16501650
},
16511651
$options['autoTLS'] ?? null,
1652-
$options['mailer'] ?: null,
1653-
$options['fromName'] ?: null,
1654-
$options['fromEmail'] ?: null,
1655-
$options['replyToName'] ?: null,
1656-
$options['replyToEmail'] ?: null,
1652+
($options['mailer'] ?? '') ?: null,
1653+
($options['fromName'] ?? '') ?: null,
1654+
($options['fromEmail'] ?? '') ?: null,
1655+
($options['replyToName'] ?? '') ?: null,
1656+
($options['replyToEmail'] ?? '') ?: null,
16571657
$enabled,
16581658
),
16591659
'msg91' => $this->messaging->createMsg91Provider(
@@ -1667,31 +1667,31 @@ protected function createProvider(Provider $resource): bool
16671667
'telesign' => $this->messaging->createTelesignProvider(
16681668
$id,
16691669
$name,
1670-
$options['from'] ?: null,
1670+
($options['from'] ?? '') ?: null,
16711671
$credentials['customerId'] ?? null,
16721672
$credentials['apiKey'] ?? null,
16731673
$enabled,
16741674
),
16751675
'textmagic' => $this->messaging->createTextmagicProvider(
16761676
$id,
16771677
$name,
1678-
$options['from'] ?: null,
1678+
($options['from'] ?? '') ?: null,
16791679
$credentials['username'] ?? null,
16801680
$credentials['apiKey'] ?? null,
16811681
$enabled,
16821682
),
16831683
'twilio' => $this->messaging->createTwilioProvider(
16841684
$id,
16851685
$name,
1686-
$options['from'] ?: null,
1686+
($options['from'] ?? '') ?: null,
16871687
$credentials['accountSid'] ?? null,
16881688
$credentials['authToken'] ?? null,
16891689
$enabled,
16901690
),
16911691
'vonage' => $this->messaging->createVonageProvider(
16921692
$id,
16931693
$name,
1694-
$options['from'] ?: null,
1694+
($options['from'] ?? '') ?: null,
16951695
$credentials['apiKey'] ?? null,
16961696
$credentials['apiSecret'] ?? null,
16971697
$enabled,

0 commit comments

Comments
 (0)