FIX: Update swiftmailer librairies

This commit is contained in:
kamel
2021-12-07 17:11:34 +01:00
parent bd52613331
commit 1ca199d796
156 changed files with 2370 additions and 1637 deletions

View File

@@ -16,16 +16,16 @@
class Swift_Mime_ContentEncoder_NativeQpContentEncoder implements Swift_Mime_ContentEncoder
{
/**
* @var null|string
* @var string|null
*/
private $charset;
/**
* @param null|string $charset
* @param string|null $charset
*/
public function __construct($charset = null)
{
$this->charset = $charset ? $charset : 'utf-8';
$this->charset = $charset ?: 'utf-8';
}
/**
@@ -50,9 +50,8 @@ class Swift_Mime_ContentEncoder_NativeQpContentEncoder implements Swift_Mime_Con
*/
public function encodeByteStream(Swift_OutputByteStream $os, Swift_InputByteStream $is, $firstLineOffset = 0, $maxLineLength = 0)
{
if ($this->charset !== 'utf-8') {
throw new RuntimeException(
sprintf('Charset "%s" not supported. NativeQpContentEncoder only supports "utf-8"', $this->charset));
if ('utf-8' !== $this->charset) {
throw new RuntimeException(sprintf('Charset "%s" not supported. NativeQpContentEncoder only supports "utf-8"', $this->charset));
}
$string = '';
@@ -87,9 +86,8 @@ class Swift_Mime_ContentEncoder_NativeQpContentEncoder implements Swift_Mime_Con
*/
public function encodeString($string, $firstLineOffset = 0, $maxLineLength = 0)
{
if ($this->charset !== 'utf-8') {
throw new RuntimeException(
sprintf('Charset "%s" not supported. NativeQpContentEncoder only supports "utf-8"', $this->charset));
if ('utf-8' !== $this->charset) {
throw new RuntimeException(sprintf('Charset "%s" not supported. NativeQpContentEncoder only supports "utf-8"', $this->charset));
}
return $this->standardize(quoted_printable_encode($string));
@@ -107,9 +105,9 @@ class Swift_Mime_ContentEncoder_NativeQpContentEncoder implements Swift_Mime_Con
// transform CR or LF to CRLF
$string = preg_replace('~=0D(?!=0A)|(?<!=0D)=0A~', '=0D=0A', $string);
// transform =0D=0A to CRLF
$string = str_replace(array("\t=0D=0A", ' =0D=0A', '=0D=0A'), array("=09\r\n", "=20\r\n", "\r\n"), $string);
$string = str_replace(["\t=0D=0A", ' =0D=0A', '=0D=0A'], ["=09\r\n", "=20\r\n", "\r\n"], $string);
switch ($end = ord(substr($string, -1))) {
switch (\ord(substr($string, -1))) {
case 0x09:
$string = substr_replace($string, '=09', -1);
break;