mirror of
https://github.com/itflow-org/itflow
synced 2026-09-21 14:11:17 +00:00
Bump imapengine from 1.25.4 to 1.25.6 and dependencies
This commit is contained in:
19
libs/vendor/symfony/mime/Address.php
vendored
19
libs/vendor/symfony/mime/Address.php
vendored
@@ -54,7 +54,7 @@ final class Address
|
||||
throw new InvalidArgumentException('Email address contains control characters.');
|
||||
}
|
||||
|
||||
if (!self::$validator->isValid($this->address, class_exists(MessageIDValidation::class) ? new MessageIDValidation() : new RFCValidation())) {
|
||||
if (!self::isValidAddrSpec($this->address)) {
|
||||
throw new RfcComplianceException(\sprintf('Email "%s" does not comply with addr-spec of RFC 2822.', $address));
|
||||
}
|
||||
}
|
||||
@@ -87,7 +87,7 @@ final class Address
|
||||
return '';
|
||||
}
|
||||
|
||||
return \sprintf('"%s"', preg_replace('/"/u', '\"', $this->getName()));
|
||||
return \sprintf('"%s"', preg_replace('/["\\\\]/', '\\\\$0', $this->getName()));
|
||||
}
|
||||
|
||||
public static function create(self|string $address): self
|
||||
@@ -141,4 +141,19 @@ final class Address
|
||||
{
|
||||
return (bool) preg_match('/[\x80-\xFF].*@/', $this->address);
|
||||
}
|
||||
|
||||
private static function isValidAddrSpec(string $address): bool
|
||||
{
|
||||
// the message id validation is needed as this class also holds the ids of the Message-ID,
|
||||
// In-Reply-To and References headers, but it accepts an unquoted "@" in the local part
|
||||
if (!self::$validator->isValid($address, class_exists(MessageIDValidation::class) ? new MessageIDValidation() : new RFCValidation())) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (substr_count($address, '@') < 2) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return self::$validator->isValid(substr($address, 0, strrpos($address, '@')).'@example.com', new RFCValidation());
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user