Bump imapengine from 1.25.4 to 1.25.6 and dependencies

This commit is contained in:
johnnyq
2026-08-26 13:02:29 -04:00
parent 71cfdf5e39
commit 3d9a41bec4
54 changed files with 978 additions and 543 deletions

View File

@@ -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());
}
}