mirror of
https://github.com/Dolibarr/dolibarr.git
synced 2025-12-13 13:01:27 +01:00
FIX: Update swiftmailer librairies
This commit is contained in:
@@ -32,16 +32,18 @@ class Swift_Mime_Headers_PathHeader extends Swift_Mime_Headers_AbstractHeader
|
||||
*/
|
||||
private $emailValidator;
|
||||
|
||||
private $addressEncoder;
|
||||
|
||||
/**
|
||||
* Creates a new PathHeader with the given $name.
|
||||
*
|
||||
* @param string $name
|
||||
* @param EmailValidator $emailValidator
|
||||
* @param string $name
|
||||
*/
|
||||
public function __construct($name, EmailValidator $emailValidator)
|
||||
public function __construct($name, EmailValidator $emailValidator, Swift_AddressEncoder $addressEncoder = null)
|
||||
{
|
||||
$this->setFieldName($name);
|
||||
$this->emailValidator = $emailValidator;
|
||||
$this->addressEncoder = $addressEncoder ?? new Swift_AddressEncoder_IdnAddressEncoder();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -127,7 +129,8 @@ class Swift_Mime_Headers_PathHeader extends Swift_Mime_Headers_AbstractHeader
|
||||
{
|
||||
if (!$this->getCachedValue()) {
|
||||
if (isset($this->address)) {
|
||||
$this->setCachedValue('<'.$this->address.'>');
|
||||
$address = $this->addressEncoder->encodeString($this->address);
|
||||
$this->setCachedValue('<'.$address.'>');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -144,9 +147,7 @@ class Swift_Mime_Headers_PathHeader extends Swift_Mime_Headers_AbstractHeader
|
||||
private function assertValidAddress($address)
|
||||
{
|
||||
if (!$this->emailValidator->isValid($address, new RFCValidation())) {
|
||||
throw new Swift_RfcComplianceException(
|
||||
'Address set in PathHeader does not comply with addr-spec of RFC 2822.'
|
||||
);
|
||||
throw new Swift_RfcComplianceException('Address set in PathHeader does not comply with addr-spec of RFC 2822.');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user