From 2f0b2c82c966021f5d8ad110cb30d962730f419e Mon Sep 17 00:00:00 2001 From: matidau <65836048+matidau@users.noreply.github.com> Date: Fri, 18 Aug 2023 16:43:24 +1000 Subject: [PATCH] PHP8.0 mail() to use /r/n line endings Used less than PHP 8.0, as this is a breaking change for PHP 7.4. --- src/backend/imap/Mail/mail.php | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/backend/imap/Mail/mail.php b/src/backend/imap/Mail/mail.php index 60cc3d8b..f1bf80a6 100644 --- a/src/backend/imap/Mail/mail.php +++ b/src/backend/imap/Mail/mail.php @@ -91,10 +91,12 @@ public function __construct($params = null) /* Because the mail() function may pass headers as command * line arguments, we can't guarantee the use of the standard * "\r\n" separator. Instead, we use the system's native line - * separator. */ - if (defined('PHP_EOL')) { + * separator. + * Fixed in PHP 8.0. + */ + if (defined('PHP_EOL') && version_compare(PHP_VERSION, '8.0.0', '<')) { $this->sep = PHP_EOL; - } else { + } elseif (version_compare(PHP_VERSION, '8.0.0', '<')) { $this->sep = (strpos(PHP_OS, 'WIN') === false) ? "\n" : "\r\n"; } }