* [PATCH pit] bin/public-inbox-tg: Fix fatal error when "To:" or CC list is empty
@ 2022-02-26 19:27 Alviro Iskandar Setiawan
2022-02-26 19:40 ` Ammar Faizi
0 siblings, 1 reply; 2+ messages in thread
From: Alviro Iskandar Setiawan @ 2022-02-26 19:27 UTC (permalink / raw)
To: Ammar Faizi
Cc: GNU/Weeb Mailing List, Alviro Iskandar Setiawan, Nugra,
Alviro Iskandar Setiawan, Arthur Lapz
When "To:" or CC list is empty, we don't have the $toList or $ccList
variable, we must always check their existence before entering the
array_merge() call. Fix it by using null coalescing operator and
fallback to an empty array.
Link: https://t.me/GNUWeeb/544137
Reported-by: Arthur Lapz <[email protected]>
Fixes: b7a968b53f42f7392ac2fb3450524bb4a949baab ("bin/public-inbox-tg: Add Telegram CC notification support")
Signed-off-by: Alviro Iskandar Setiawan <[email protected]>
---
bin/public-inbox-tg.php | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/bin/public-inbox-tg.php b/bin/public-inbox-tg.php
index 61d4968..f17fffe 100644
--- a/bin/public-inbox-tg.php
+++ b/bin/public-inbox-tg.php
@@ -157,7 +157,10 @@ function fx(string $input): int
if ($ccListStr)
$msg .= "{$ccListStr}\n";
- $tgCCs = array_merge(...[listTelegramLookup($toList), listTelegramLookup($ccList)]);
+ $tgCCs = array_merge(...[
+ listTelegramLookup($toList ?? []),
+ listTelegramLookup($ccList ?? [])
+ ]);
$tgCCs = array_unique($tgCCs);
if (count($tgCCs) > 0)
base-commit: 48fc9b434d878691d11c77beab3fa459a337ce48
--
2.32.0
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH pit] bin/public-inbox-tg: Fix fatal error when "To:" or CC list is empty
2022-02-26 19:27 [PATCH pit] bin/public-inbox-tg: Fix fatal error when "To:" or CC list is empty Alviro Iskandar Setiawan
@ 2022-02-26 19:40 ` Ammar Faizi
0 siblings, 0 replies; 2+ messages in thread
From: Ammar Faizi @ 2022-02-26 19:40 UTC (permalink / raw)
To: Alviro Iskandar Setiawan
Cc: GNU/Weeb Mailing List, Alviro Iskandar Setiawan, Nugra,
Arthur Lapz
On Sat, 26 Feb 2022 19:27:50 +0000, Alviro Iskandar Setiawan wrote:
> When "To:" or CC list is empty, we don't have the $toList or $ccList
> variable, we must always check their existence before entering the
> array_merge() call. Fix it by using null coalescing operator and
> fallback to an empty array.
>
> [...]
Applied, thanks!
[1/1] bin/public-inbox-tg: Fix fatal error when "To:" or CC list is empty
commit: e6a29a4eb182909bea7b34013796e5d351c66192
Best regards,
--
Ammar Faizi
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2022-02-26 19:40 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-02-26 19:27 [PATCH pit] bin/public-inbox-tg: Fix fatal error when "To:" or CC list is empty Alviro Iskandar Setiawan
2022-02-26 19:40 ` Ammar Faizi
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox