From d8af3e342f0905ce1ca984aacdbd9dca3d453cb6 Mon Sep 17 00:00:00 2001 From: Markus Thielen Date: Thu, 25 Apr 2024 09:00:41 +0200 Subject: [PATCH 1/4] sub-parts index start with 1, not 0 --- src/PhpImap/Mailbox.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/PhpImap/Mailbox.php b/src/PhpImap/Mailbox.php index 02a3dad9..d066ff64 100644 --- a/src/PhpImap/Mailbox.php +++ b/src/PhpImap/Mailbox.php @@ -1288,7 +1288,7 @@ public function flattenParts(array $messageParts, array $flattenedParts = [], st $part_parts = $part->parts; if (self::PART_TYPE_TWO == $part->type) { - $flattenedParts = $this->flattenParts($part_parts, $flattenedParts, $prefix.$index.'.', 0, false); + $flattenedParts = $this->flattenParts($part_parts, $flattenedParts, $prefix.$index.'.', 1, false); } elseif ($fullPrefix) { $flattenedParts = $this->flattenParts($part_parts, $flattenedParts, $prefix.$index.'.'); } else { From 9e898b70f16e06ef92ddfb8fb29f308440a7eac8 Mon Sep 17 00:00:00 2001 From: Markus Thielen Date: Thu, 12 Dec 2024 12:31:34 +0100 Subject: [PATCH 2/4] php8.4 polyfill --- src/PhpImap/Imap.php | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/PhpImap/Imap.php b/src/PhpImap/Imap.php index 655c1dc8..95c3eaf9 100644 --- a/src/PhpImap/Imap.php +++ b/src/PhpImap/Imap.php @@ -7,6 +7,14 @@ namespace PhpImap; +//if php 8.4 define constants +if (!\defined('IMAP_OPENTIMEOUT')) { + define('IMAP_OPENTIMEOUT', 1); + define('IMAP_READTIMEOUT', 2); + define('IMAP_WRITETIMEOUT', 3); + define('IMAP_CLOSETIMEOUT', 4); +} + use const CL_EXPUNGE; use const IMAP_CLOSETIMEOUT; use const IMAP_OPENTIMEOUT; From 0941639591b93fc1ff8741c2562c2596c554f4a8 Mon Sep 17 00:00:00 2001 From: Markus Thielen Date: Thu, 12 Dec 2024 12:40:36 +0100 Subject: [PATCH 3/4] php8.4 polyfill --- composer.json | 3 +++ src/PhpImap/Imap.php | 8 -------- src/polyfill.php | 9 +++++++++ 3 files changed, 12 insertions(+), 8 deletions(-) create mode 100644 src/polyfill.php diff --git a/composer.json b/composer.json index 9b44d8e2..c7322c5e 100644 --- a/composer.json +++ b/composer.json @@ -65,6 +65,9 @@ } }, "autoload": { + "files": [ + "src/polyfill.php" + ], "psr-4": { "PhpImap\\": "src/PhpImap" } diff --git a/src/PhpImap/Imap.php b/src/PhpImap/Imap.php index 95c3eaf9..655c1dc8 100644 --- a/src/PhpImap/Imap.php +++ b/src/PhpImap/Imap.php @@ -7,14 +7,6 @@ namespace PhpImap; -//if php 8.4 define constants -if (!\defined('IMAP_OPENTIMEOUT')) { - define('IMAP_OPENTIMEOUT', 1); - define('IMAP_READTIMEOUT', 2); - define('IMAP_WRITETIMEOUT', 3); - define('IMAP_CLOSETIMEOUT', 4); -} - use const CL_EXPUNGE; use const IMAP_CLOSETIMEOUT; use const IMAP_OPENTIMEOUT; diff --git a/src/polyfill.php b/src/polyfill.php new file mode 100644 index 00000000..c8502ca2 --- /dev/null +++ b/src/polyfill.php @@ -0,0 +1,9 @@ +=')) { + define('IMAP_OPENTIMEOUT', 1); + define('IMAP_READTIMEOUT', 2); + define('IMAP_WRITETIMEOUT', 3); + define('IMAP_CLOSETIMEOUT', 4); +} From cbe98f705afc74662d36088d352562f28768f370 Mon Sep 17 00:00:00 2001 From: Markus Thielen Date: Thu, 12 Dec 2024 15:44:55 +0100 Subject: [PATCH 4/4] no need for that with PECL --- composer.json | 3 --- src/polyfill.php | 9 --------- 2 files changed, 12 deletions(-) delete mode 100644 src/polyfill.php diff --git a/composer.json b/composer.json index c7322c5e..9b44d8e2 100644 --- a/composer.json +++ b/composer.json @@ -65,9 +65,6 @@ } }, "autoload": { - "files": [ - "src/polyfill.php" - ], "psr-4": { "PhpImap\\": "src/PhpImap" } diff --git a/src/polyfill.php b/src/polyfill.php deleted file mode 100644 index c8502ca2..00000000 --- a/src/polyfill.php +++ /dev/null @@ -1,9 +0,0 @@ -=')) { - define('IMAP_OPENTIMEOUT', 1); - define('IMAP_READTIMEOUT', 2); - define('IMAP_WRITETIMEOUT', 3); - define('IMAP_CLOSETIMEOUT', 4); -}