N°5809 Update laminas/laminas-mail from 2.16.0 to 2.22.0

This commit is contained in:
Pierre Goiffon
2024-01-25 17:24:43 +01:00
parent f3d3ec6ef7
commit 0f39ea8ac7
146 changed files with 4426 additions and 8899 deletions

View File

@@ -491,17 +491,22 @@ class Mime
* Mail headers depend on an extended quoted printable algorithm otherwise
* a range of bugs can occur.
*
* @param string $str
* @param string $charset
* @param int $lineLength Defaults to {@link LINELENGTH}
* @param string $lineEnd Defaults to {@link LINEEND}
* @param string $str
* @param string $charset
* @param int $lineLength Defaults to {@link LINELENGTH}
* @param string $lineEnd Defaults to {@link LINEEND}
* @param positive-int|0 $headerNameSize When folding a line, it is necessary to calculate
* the length of the entire line (together with the header name).
* Therefore, you can specify the header name and colon length
* in this argument to fold the string properly.
* @return string
*/
public static function encodeQuotedPrintableHeader(
$str,
$charset,
$lineLength = self::LINELENGTH,
$lineEnd = self::LINEEND
$lineEnd = self::LINEEND,
$headerNameSize = 0
) {
// Reduce line-length by the length of the required delimiter, charsets and encoding
$prefix = sprintf('=?%s?Q?', $charset);
@@ -527,7 +532,14 @@ class Mime
if ($token === '=20') {
// only if we have a single char token or space, we can append the
// tempstring it to the current line or start a new line if necessary.
$lineLimitReached = strlen($lines[$currentLine] . $tmp) > $lineLength;
if ($currentLine === 0) {
// The size of the first line should be calculated with the header name.
$currentLineLength = strlen($lines[$currentLine] . $tmp) + $headerNameSize;
} else {
$currentLineLength = strlen($lines[$currentLine] . $tmp);
}
$lineLimitReached = $currentLineLength > $lineLength;
$noCurrentLine = $lines[$currentLine] === '';
if ($noCurrentLine && $lineLimitReached) {
$lines[$currentLine] = $tmp;

View File

@@ -3,7 +3,6 @@
namespace Laminas\Mime;
use function array_key_exists;
use function get_class;
use function gettype;
use function is_object;
use function is_resource;
@@ -315,7 +314,7 @@ class Part
if (! is_string($content) && ! is_resource($content)) {
throw new Exception\InvalidArgumentException(sprintf(
'Content must be string or resource; received "%s"',
is_object($content) ? get_class($content) : gettype($content)
is_object($content) ? $content::class : gettype($content)
));
}
$this->content = $content;