From a579a974ebfe8e91f98a34d2e5269a91c5307cb7 Mon Sep 17 00:00:00 2001 From: Andre Klapper Date: Fri, 17 May 2024 15:56:06 +0200 Subject: [PATCH] PHPMailer: Remove use of each() function removed in PHP 8.0 Summary: `each()` has been deprecated since PHP 7.2 and got removed in PHP 8.0 per https://www.php.net/manual/en/function.each.php Replace it with a `foreach` construction. Closes T15833 Test Plan: Carefully read the code; locally testing that construction per D25659#18155; compare to similar rP9623e667458821f696eb92e9dac5a2c9720af7af Reviewers: O1 Blessed Committers, valerio.bozzolan Reviewed By: O1 Blessed Committers, valerio.bozzolan Subscribers: tobiaswiese, valerio.bozzolan, Matthew, Cigaryno Maniphest Tasks: T15833 Differential Revision: https://we.phorge.it/D25659 --- externals/phpmailer/class.phpmailer-lite.php | 4 ++-- externals/phpmailer/class.phpmailer.php | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/externals/phpmailer/class.phpmailer-lite.php b/externals/phpmailer/class.phpmailer-lite.php index 06cf5cc9c3..61b11d99b1 100644 --- a/externals/phpmailer/class.phpmailer-lite.php +++ b/externals/phpmailer/class.phpmailer-lite.php @@ -1487,7 +1487,7 @@ class PHPMailerLite { $eol = "\r\n"; $escape = '='; $output = ''; - while( list(, $line) = each($lines) ) { + foreach ($lines as $line) { $linlen = strlen($line); $newline = ''; for($i = 0; $i < $linlen; $i++) { @@ -1518,7 +1518,7 @@ class PHPMailerLite { $newline .= $c; } // end of for $output .= $newline.$eol; - } // end of while + } // end of foreach return $output; } diff --git a/externals/phpmailer/class.phpmailer.php b/externals/phpmailer/class.phpmailer.php index 0a413a407b..001876af65 100644 --- a/externals/phpmailer/class.phpmailer.php +++ b/externals/phpmailer/class.phpmailer.php @@ -1619,7 +1619,7 @@ class PHPMailer { $eol = "\r\n"; $escape = '='; $output = ''; - while( list(, $line) = each($lines) ) { + foreach ($lines as $line) { $linlen = strlen($line); $newline = ''; for($i = 0; $i < $linlen; $i++) { @@ -1650,7 +1650,7 @@ class PHPMailer { $newline .= $c; } // end of for $output .= $newline.$eol; - } // end of while + } // end of foreach return $output; }