diff --git a/lib/IMAP/ImapMessageFetcher.php b/lib/IMAP/ImapMessageFetcher.php index aacacd5e0e..9001b9250f 100644 --- a/lib/IMAP/ImapMessageFetcher.php +++ b/lib/IMAP/ImapMessageFetcher.php @@ -504,7 +504,12 @@ private function decodeSubject(Horde_Imap_Client_Data_Envelope $envelope): strin if ($utf8 !== false) { return $utf8; } - return iconv('UTF-8', 'UTF-8//IGNORE', $subject); + $utf8Ignored = iconv('UTF-8', 'UTF-8//IGNORE', $subject); + if ($utf8Ignored === false) { + // Give up + return $subject; + } + return $utf8Ignored; } private function parseHeaders(Horde_Imap_Client_Data_Fetch $fetch): void { diff --git a/lib/Service/Avatar/Downloader.php b/lib/Service/Avatar/Downloader.php index d7727eb1b6..f1b4b3de1b 100644 --- a/lib/Service/Avatar/Downloader.php +++ b/lib/Service/Avatar/Downloader.php @@ -22,11 +22,7 @@ public function __construct(IClientService $clientService) { $this->clientService = $clientService; } - /** - * @param string $url - * @return string|null - */ - public function download(string $url) { + public function download(string $url): ?string { $client = $this->clientService->newClient(); try { @@ -37,7 +33,7 @@ public function download(string $url) { $body = $resp->getBody(); if (is_resource($body)) { - return stream_get_contents($body); + return stream_get_contents($body) ?: null; } return $body; }