forked from Wavyzz/dolibarr
FIX: Update swiftmailer librairies
This commit is contained in:
@@ -30,11 +30,7 @@ class Swift_Mime_MimePart extends Swift_Mime_SimpleMimeEntity
|
||||
/**
|
||||
* Create a new MimePart with $headers, $encoder and $cache.
|
||||
*
|
||||
* @param Swift_Mime_SimpleHeaderSet $headers
|
||||
* @param Swift_Mime_ContentEncoder $encoder
|
||||
* @param Swift_KeyCache $cache
|
||||
* @param Swift_IdGenerator $idGenerator
|
||||
* @param string $charset
|
||||
* @param string $charset
|
||||
*/
|
||||
public function __construct(Swift_Mime_SimpleHeaderSet $headers, Swift_Mime_ContentEncoder $encoder, Swift_KeyCache $cache, Swift_IdGenerator $idGenerator, $charset = null)
|
||||
{
|
||||
@@ -173,7 +169,7 @@ class Swift_Mime_MimePart extends Swift_Mime_SimpleMimeEntity
|
||||
protected function fixHeaders()
|
||||
{
|
||||
parent::fixHeaders();
|
||||
if (count($this->getChildren())) {
|
||||
if (\count($this->getChildren())) {
|
||||
$this->setHeaderParameter('Content-Type', 'charset', null);
|
||||
$this->setHeaderParameter('Content-Type', 'format', null);
|
||||
$this->setHeaderParameter('Content-Type', 'delsp', null);
|
||||
@@ -193,18 +189,9 @@ class Swift_Mime_MimePart extends Swift_Mime_SimpleMimeEntity
|
||||
/** Encode charset when charset is not utf-8 */
|
||||
protected function convertString($string)
|
||||
{
|
||||
$charset = strtolower($this->getCharset());
|
||||
if (!in_array($charset, array('utf-8', 'iso-8859-1', 'iso-8859-15', ''))) {
|
||||
// mb_convert_encoding must be the first one to check, since iconv cannot convert some words.
|
||||
if (function_exists('mb_convert_encoding')) {
|
||||
$string = mb_convert_encoding($string, $charset, 'utf-8');
|
||||
} elseif (function_exists('iconv')) {
|
||||
$string = iconv('utf-8//TRANSLIT//IGNORE', $charset, $string);
|
||||
} else {
|
||||
throw new Swift_SwiftException('No suitable convert encoding function (use UTF-8 as your charset or install the mbstring or iconv extension).');
|
||||
}
|
||||
|
||||
return $string;
|
||||
$charset = strtolower($this->getCharset() ?? '');
|
||||
if (!\in_array($charset, ['utf-8', 'iso-8859-1', 'iso-8859-15', ''])) {
|
||||
return mb_convert_encoding($string, $charset, 'utf-8');
|
||||
}
|
||||
|
||||
return $string;
|
||||
|
||||
Reference in New Issue
Block a user