mirror of
https://github.com/Dolibarr/dolibarr.git
synced 2025-12-10 03:28:18 +01:00
FIX: Update swiftmailer librairies
This commit is contained in:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user