mirror of
https://github.com/linuxserver/Heimdall.git
synced 2025-12-03 21:49:56 +09:00
Update to laravel 7
This commit is contained in:
@@ -11,29 +11,21 @@
|
||||
|
||||
namespace Symfony\Component\Mime\Encoder;
|
||||
|
||||
use Symfony\Component\Mime\Exception\AddressEncoderException;
|
||||
|
||||
/**
|
||||
* An IDN email address encoder.
|
||||
*
|
||||
* Encodes the domain part of an address using IDN. This is compatible will all
|
||||
* SMTP servers.
|
||||
*
|
||||
* This encoder does not support email addresses with non-ASCII characters in
|
||||
* local-part (the substring before @). To send to such addresses, use
|
||||
* Utf8AddressEncoder together with SmtpUtf8Handler. Your outbound SMTP server must support
|
||||
* the SMTPUTF8 extension.
|
||||
* Note: It leaves the local part as is. In case there are non-ASCII characters
|
||||
* in the local part then it depends on the SMTP Server if this is supported.
|
||||
*
|
||||
* @author Christian Schmidt
|
||||
*
|
||||
* @experimental in 4.3
|
||||
*/
|
||||
final class IdnAddressEncoder implements AddressEncoderInterface
|
||||
{
|
||||
/**
|
||||
* Encodes the domain part of an address using IDN.
|
||||
*
|
||||
* @throws AddressEncoderException If local-part contains non-ASCII characters
|
||||
*/
|
||||
public function encodeString(string $address): string
|
||||
{
|
||||
@@ -42,12 +34,8 @@ final class IdnAddressEncoder implements AddressEncoderInterface
|
||||
$local = substr($address, 0, $i);
|
||||
$domain = substr($address, $i + 1);
|
||||
|
||||
if (preg_match('/[^\x00-\x7F]/', $local)) {
|
||||
throw new AddressEncoderException(sprintf('Non-ASCII characters not supported in local-part os "%s".', $address));
|
||||
}
|
||||
|
||||
if (preg_match('/[^\x00-\x7F]/', $domain)) {
|
||||
$address = sprintf('%s@%s', $local, idn_to_ascii($domain, 0, INTL_IDNA_VARIANT_UTS46));
|
||||
$address = sprintf('%s@%s', $local, idn_to_ascii($domain, \IDNA_DEFAULT | \IDNA_USE_STD3_RULES | \IDNA_CHECK_BIDI | \IDNA_CHECK_CONTEXTJ | \IDNA_NONTRANSITIONAL_TO_ASCII, \INTL_IDNA_VARIANT_UTS46));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user