From 2cf2d302e2c0ff661c7e264aae77323f504bb98a Mon Sep 17 00:00:00 2001 From: TS3tools Date: Mon, 16 Nov 2020 11:27:58 +0100 Subject: [PATCH 1/3] Revert "Fix for #525 How to detect textPlain encoding" --- src/PhpImap/DataPartInfo.php | 3 +-- src/PhpImap/Mailbox.php | 5 ++--- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/src/PhpImap/DataPartInfo.php b/src/PhpImap/DataPartInfo.php index 173d1e59..b02c1c94 100644 --- a/src/PhpImap/DataPartInfo.php +++ b/src/PhpImap/DataPartInfo.php @@ -109,8 +109,7 @@ protected function convertEncodingAfterFetch(): string { if (isset($this->charset) and !empty(\trim($this->charset))) { $this->data = $this->mail->decodeMimeStr( - (string) $this->data, // Data to convert - (string) \trim($this->charset) + (string) $this->data // Data to convert ); } diff --git a/src/PhpImap/Mailbox.php b/src/PhpImap/Mailbox.php index 5cdfc933..a50befbf 100644 --- a/src/PhpImap/Mailbox.php +++ b/src/PhpImap/Mailbox.php @@ -1333,7 +1333,6 @@ public function downloadAttachment(DataPartInfo $dataInfo, array $params, object * Decodes a mime string. * * @param string $string MIME string to decode - * @param string|null $charsetPreferred The charset of the data part info if it was set * * @return string Converted string if conversion was successful, or the original string if not * @@ -1341,7 +1340,7 @@ public function downloadAttachment(DataPartInfo $dataInfo, array $params, object * * @todo update implementation pending resolution of https://github.com/vimeo/psalm/issues/2619 & https://github.com/vimeo/psalm/issues/2620 */ - public function decodeMimeStr(string $string, ?string $charsetPreferred = null): string + public function decodeMimeStr(string $string): string { $newString = ''; /** @var list|false */ @@ -1355,7 +1354,7 @@ public function decodeMimeStr(string $string, ?string $charsetPreferred = null): $charset = \strtolower($element->charset); if ('default' === $charset) { - $charset = !empty($charsetPreferred) ? $charsetPreferred : $this->decodeMimeStrDefaultCharset; + $charset = $this->decodeMimeStrDefaultCharset; } switch ($charset) { From 83c487fad58df0c9fdf9d185244e537a55e09666 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20Bar=C3=A1=C5=A1ek?= Date: Tue, 9 Feb 2021 17:54:52 +0100 Subject: [PATCH 2/3] Composer.json: Add support for PHP 8 --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index 14603fe2..307ce334 100644 --- a/composer.json +++ b/composer.json @@ -23,7 +23,7 @@ "sort-packages": true }, "require": { - "php": "^7.2", + "php": "^7.2 || ^8.0", "ext-fileinfo": "*", "ext-iconv": "*", "ext-imap": "*", From 68d46669de553dadc90e3dacf31f0aaac2476e53 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20Bar=C3=A1=C5=A1ek?= Date: Tue, 9 Feb 2021 18:05:54 +0100 Subject: [PATCH 3/3] Use version from PHP 8.0 to <8.1 --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index 307ce334..76ddc926 100644 --- a/composer.json +++ b/composer.json @@ -23,7 +23,7 @@ "sort-packages": true }, "require": { - "php": "^7.2 || ^8.0", + "php": "^7.2 || ^8.0 <8.1", "ext-fileinfo": "*", "ext-iconv": "*", "ext-imap": "*",