first commit

This commit is contained in:
Sampanna Rimal
2024-08-27 17:48:06 +05:45
commit 53c0140f58
10839 changed files with 1125847 additions and 0 deletions

923
vendor/symfony/polyfill-intl-idn/Idn.php vendored Normal file
View File

@ -0,0 +1,923 @@
<?php
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com> and Trevor Rowbotham <trevor.rowbotham@pm.me>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Polyfill\Intl\Idn;
use Symfony\Polyfill\Intl\Idn\Resources\unidata\DisallowedRanges;
use Symfony\Polyfill\Intl\Idn\Resources\unidata\Regex;
/**
* @see https://www.unicode.org/reports/tr46/
*
* @internal
*/
final class Idn
{
public const ERROR_EMPTY_LABEL = 1;
public const ERROR_LABEL_TOO_LONG = 2;
public const ERROR_DOMAIN_NAME_TOO_LONG = 4;
public const ERROR_LEADING_HYPHEN = 8;
public const ERROR_TRAILING_HYPHEN = 0x10;
public const ERROR_HYPHEN_3_4 = 0x20;
public const ERROR_LEADING_COMBINING_MARK = 0x40;
public const ERROR_DISALLOWED = 0x80;
public const ERROR_PUNYCODE = 0x100;
public const ERROR_LABEL_HAS_DOT = 0x200;
public const ERROR_INVALID_ACE_LABEL = 0x400;
public const ERROR_BIDI = 0x800;
public const ERROR_CONTEXTJ = 0x1000;
public const ERROR_CONTEXTO_PUNCTUATION = 0x2000;
public const ERROR_CONTEXTO_DIGITS = 0x4000;
public const INTL_IDNA_VARIANT_2003 = 0;
public const INTL_IDNA_VARIANT_UTS46 = 1;
public const IDNA_DEFAULT = 0;
public const IDNA_ALLOW_UNASSIGNED = 1;
public const IDNA_USE_STD3_RULES = 2;
public const IDNA_CHECK_BIDI = 4;
public const IDNA_CHECK_CONTEXTJ = 8;
public const IDNA_NONTRANSITIONAL_TO_ASCII = 16;
public const IDNA_NONTRANSITIONAL_TO_UNICODE = 32;
public const MAX_DOMAIN_SIZE = 253;
public const MAX_LABEL_SIZE = 63;
public const BASE = 36;
public const TMIN = 1;
public const TMAX = 26;
public const SKEW = 38;
public const DAMP = 700;
public const INITIAL_BIAS = 72;
public const INITIAL_N = 128;
public const DELIMITER = '-';
public const MAX_INT = 2147483647;
/**
* Contains the numeric value of a basic code point (for use in representing integers) in the
* range 0 to BASE-1, or -1 if b is does not represent a value.
*
* @var array<int, int>
*/
private static $basicToDigit = [
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
26, 27, 28, 29, 30, 31, 32, 33, 34, 35, -1, -1, -1, -1, -1, -1,
-1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, -1, -1, -1, -1, -1,
-1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
];
/**
* @var array<int, int>
*/
private static $virama;
/**
* @var array<int, string>
*/
private static $mapped;
/**
* @var array<int, bool>
*/
private static $ignored;
/**
* @var array<int, string>
*/
private static $deviation;
/**
* @var array<int, bool>
*/
private static $disallowed;
/**
* @var array<int, string>
*/
private static $disallowed_STD3_mapped;
/**
* @var array<int, bool>
*/
private static $disallowed_STD3_valid;
/**
* @var bool
*/
private static $mappingTableLoaded = false;
/**
* @see https://www.unicode.org/reports/tr46/#ToASCII
*
* @param string $domainName
* @param int $options
* @param int $variant
* @param array $idna_info
*
* @return string|false
*/
public static function idn_to_ascii($domainName, $options = self::IDNA_DEFAULT, $variant = self::INTL_IDNA_VARIANT_UTS46, &$idna_info = [])
{
if (\PHP_VERSION_ID >= 70200 && self::INTL_IDNA_VARIANT_2003 === $variant) {
@trigger_error('idn_to_ascii(): INTL_IDNA_VARIANT_2003 is deprecated', \E_USER_DEPRECATED);
}
$options = [
'CheckHyphens' => true,
'CheckBidi' => self::INTL_IDNA_VARIANT_2003 === $variant || 0 !== ($options & self::IDNA_CHECK_BIDI),
'CheckJoiners' => self::INTL_IDNA_VARIANT_UTS46 === $variant && 0 !== ($options & self::IDNA_CHECK_CONTEXTJ),
'UseSTD3ASCIIRules' => 0 !== ($options & self::IDNA_USE_STD3_RULES),
'Transitional_Processing' => self::INTL_IDNA_VARIANT_2003 === $variant || 0 === ($options & self::IDNA_NONTRANSITIONAL_TO_ASCII),
'VerifyDnsLength' => true,
];
$info = new Info();
$labels = self::process((string) $domainName, $options, $info);
foreach ($labels as $i => $label) {
// Only convert labels to punycode that contain non-ASCII code points
if (1 === preg_match('/[^\x00-\x7F]/', $label)) {
try {
$label = 'xn--'.self::punycodeEncode($label);
} catch (\Exception $e) {
$info->errors |= self::ERROR_PUNYCODE;
}
$labels[$i] = $label;
}
}
if ($options['VerifyDnsLength']) {
self::validateDomainAndLabelLength($labels, $info);
}
$idna_info = [
'result' => implode('.', $labels),
'isTransitionalDifferent' => $info->transitionalDifferent,
'errors' => $info->errors,
];
return 0 === $info->errors ? $idna_info['result'] : false;
}
/**
* @see https://www.unicode.org/reports/tr46/#ToUnicode
*
* @param string $domainName
* @param int $options
* @param int $variant
* @param array $idna_info
*
* @return string|false
*/
public static function idn_to_utf8($domainName, $options = self::IDNA_DEFAULT, $variant = self::INTL_IDNA_VARIANT_UTS46, &$idna_info = [])
{
if (\PHP_VERSION_ID >= 70200 && self::INTL_IDNA_VARIANT_2003 === $variant) {
@trigger_error('idn_to_utf8(): INTL_IDNA_VARIANT_2003 is deprecated', \E_USER_DEPRECATED);
}
$info = new Info();
$labels = self::process((string) $domainName, [
'CheckHyphens' => true,
'CheckBidi' => self::INTL_IDNA_VARIANT_2003 === $variant || 0 !== ($options & self::IDNA_CHECK_BIDI),
'CheckJoiners' => self::INTL_IDNA_VARIANT_UTS46 === $variant && 0 !== ($options & self::IDNA_CHECK_CONTEXTJ),
'UseSTD3ASCIIRules' => 0 !== ($options & self::IDNA_USE_STD3_RULES),
'Transitional_Processing' => self::INTL_IDNA_VARIANT_2003 === $variant || 0 === ($options & self::IDNA_NONTRANSITIONAL_TO_UNICODE),
], $info);
$idna_info = [
'result' => implode('.', $labels),
'isTransitionalDifferent' => $info->transitionalDifferent,
'errors' => $info->errors,
];
return 0 === $info->errors ? $idna_info['result'] : false;
}
/**
* @param string $label
*
* @return bool
*/
private static function isValidContextJ(array $codePoints, $label)
{
if (!isset(self::$virama)) {
self::$virama = require __DIR__.\DIRECTORY_SEPARATOR.'Resources'.\DIRECTORY_SEPARATOR.'unidata'.\DIRECTORY_SEPARATOR.'virama.php';
}
$offset = 0;
foreach ($codePoints as $i => $codePoint) {
if (0x200C !== $codePoint && 0x200D !== $codePoint) {
continue;
}
if (!isset($codePoints[$i - 1])) {
return false;
}
// If Canonical_Combining_Class(Before(cp)) .eq. Virama Then True;
if (isset(self::$virama[$codePoints[$i - 1]])) {
continue;
}
// If RegExpMatch((Joining_Type:{L,D})(Joining_Type:T)*\u200C(Joining_Type:T)*(Joining_Type:{R,D})) Then
// True;
// Generated RegExp = ([Joining_Type:{L,D}][Joining_Type:T]*\u200C[Joining_Type:T]*)[Joining_Type:{R,D}]
if (0x200C === $codePoint && 1 === preg_match(Regex::ZWNJ, $label, $matches, \PREG_OFFSET_CAPTURE, $offset)) {
$offset += \strlen($matches[1][0]);
continue;
}
return false;
}
return true;
}
/**
* @see https://www.unicode.org/reports/tr46/#ProcessingStepMap
*
* @param string $input
* @param array<string, bool> $options
*
* @return string
*/
private static function mapCodePoints($input, array $options, Info $info)
{
$str = '';
$useSTD3ASCIIRules = $options['UseSTD3ASCIIRules'];
$transitional = $options['Transitional_Processing'];
foreach (self::utf8Decode($input) as $codePoint) {
$data = self::lookupCodePointStatus($codePoint, $useSTD3ASCIIRules);
switch ($data['status']) {
case 'disallowed':
$info->errors |= self::ERROR_DISALLOWED;
// no break.
case 'valid':
$str .= mb_chr($codePoint, 'utf-8');
break;
case 'ignored':
// Do nothing.
break;
case 'mapped':
$str .= $data['mapping'];
break;
case 'deviation':
$info->transitionalDifferent = true;
$str .= ($transitional ? $data['mapping'] : mb_chr($codePoint, 'utf-8'));
break;
}
}
return $str;
}
/**
* @see https://www.unicode.org/reports/tr46/#Processing
*
* @param string $domain
* @param array<string, bool> $options
*
* @return array<int, string>
*/
private static function process($domain, array $options, Info $info)
{
// If VerifyDnsLength is not set, we are doing ToUnicode otherwise we are doing ToASCII and
// we need to respect the VerifyDnsLength option.
$checkForEmptyLabels = !isset($options['VerifyDnsLength']) || $options['VerifyDnsLength'];
if ($checkForEmptyLabels && '' === $domain) {
$info->errors |= self::ERROR_EMPTY_LABEL;
return [$domain];
}
// Step 1. Map each code point in the domain name string
$domain = self::mapCodePoints($domain, $options, $info);
// Step 2. Normalize the domain name string to Unicode Normalization Form C.
if (!\Normalizer::isNormalized($domain, \Normalizer::FORM_C)) {
$domain = \Normalizer::normalize($domain, \Normalizer::FORM_C);
}
// Step 3. Break the string into labels at U+002E (.) FULL STOP.
$labels = explode('.', $domain);
$lastLabelIndex = \count($labels) - 1;
// Step 4. Convert and validate each label in the domain name string.
foreach ($labels as $i => $label) {
$validationOptions = $options;
if ('xn--' === substr($label, 0, 4)) {
try {
$label = self::punycodeDecode(substr($label, 4));
} catch (\Exception $e) {
$info->errors |= self::ERROR_PUNYCODE;
continue;
}
$validationOptions['Transitional_Processing'] = false;
$labels[$i] = $label;
}
self::validateLabel($label, $info, $validationOptions, $i > 0 && $i === $lastLabelIndex);
}
if ($info->bidiDomain && !$info->validBidiDomain) {
$info->errors |= self::ERROR_BIDI;
}
// Any input domain name string that does not record an error has been successfully
// processed according to this specification. Conversely, if an input domain_name string
// causes an error, then the processing of the input domain_name string fails. Determining
// what to do with error input is up to the caller, and not in the scope of this document.
return $labels;
}
/**
* @see https://tools.ietf.org/html/rfc5893#section-2
*
* @param string $label
*/
private static function validateBidiLabel($label, Info $info)
{
if (1 === preg_match(Regex::RTL_LABEL, $label)) {
$info->bidiDomain = true;
// Step 1. The first character must be a character with Bidi property L, R, or AL.
// If it has the R or AL property, it is an RTL label
if (1 !== preg_match(Regex::BIDI_STEP_1_RTL, $label)) {
$info->validBidiDomain = false;
return;
}
// Step 2. In an RTL label, only characters with the Bidi properties R, AL, AN, EN, ES,
// CS, ET, ON, BN, or NSM are allowed.
if (1 === preg_match(Regex::BIDI_STEP_2, $label)) {
$info->validBidiDomain = false;
return;
}
// Step 3. In an RTL label, the end of the label must be a character with Bidi property
// R, AL, EN, or AN, followed by zero or more characters with Bidi property NSM.
if (1 !== preg_match(Regex::BIDI_STEP_3, $label)) {
$info->validBidiDomain = false;
return;
}
// Step 4. In an RTL label, if an EN is present, no AN may be present, and vice versa.
if (1 === preg_match(Regex::BIDI_STEP_4_AN, $label) && 1 === preg_match(Regex::BIDI_STEP_4_EN, $label)) {
$info->validBidiDomain = false;
return;
}
return;
}
// We are a LTR label
// Step 1. The first character must be a character with Bidi property L, R, or AL.
// If it has the L property, it is an LTR label.
if (1 !== preg_match(Regex::BIDI_STEP_1_LTR, $label)) {
$info->validBidiDomain = false;
return;
}
// Step 5. In an LTR label, only characters with the Bidi properties L, EN,
// ES, CS, ET, ON, BN, or NSM are allowed.
if (1 === preg_match(Regex::BIDI_STEP_5, $label)) {
$info->validBidiDomain = false;
return;
}
// Step 6.In an LTR label, the end of the label must be a character with Bidi property L or
// EN, followed by zero or more characters with Bidi property NSM.
if (1 !== preg_match(Regex::BIDI_STEP_6, $label)) {
$info->validBidiDomain = false;
return;
}
}
/**
* @param array<int, string> $labels
*/
private static function validateDomainAndLabelLength(array $labels, Info $info)
{
$maxDomainSize = self::MAX_DOMAIN_SIZE;
$length = \count($labels);
// Number of "." delimiters.
$domainLength = $length - 1;
// If the last label is empty and it is not the first label, then it is the root label.
// Increase the max size by 1, making it 254, to account for the root label's "."
// delimiter. This also means we don't need to check the last label's length for being too
// long.
if ($length > 1 && '' === $labels[$length - 1]) {
++$maxDomainSize;
--$length;
}
for ($i = 0; $i < $length; ++$i) {
$bytes = \strlen($labels[$i]);
$domainLength += $bytes;
if ($bytes > self::MAX_LABEL_SIZE) {
$info->errors |= self::ERROR_LABEL_TOO_LONG;
}
}
if ($domainLength > $maxDomainSize) {
$info->errors |= self::ERROR_DOMAIN_NAME_TOO_LONG;
}
}
/**
* @see https://www.unicode.org/reports/tr46/#Validity_Criteria
*
* @param string $label
* @param array<string, bool> $options
* @param bool $canBeEmpty
*/
private static function validateLabel($label, Info $info, array $options, $canBeEmpty)
{
if ('' === $label) {
if (!$canBeEmpty && (!isset($options['VerifyDnsLength']) || $options['VerifyDnsLength'])) {
$info->errors |= self::ERROR_EMPTY_LABEL;
}
return;
}
// Step 1. The label must be in Unicode Normalization Form C.
if (!\Normalizer::isNormalized($label, \Normalizer::FORM_C)) {
$info->errors |= self::ERROR_INVALID_ACE_LABEL;
}
$codePoints = self::utf8Decode($label);
if ($options['CheckHyphens']) {
// Step 2. If CheckHyphens, the label must not contain a U+002D HYPHEN-MINUS character
// in both the thrid and fourth positions.
if (isset($codePoints[2], $codePoints[3]) && 0x002D === $codePoints[2] && 0x002D === $codePoints[3]) {
$info->errors |= self::ERROR_HYPHEN_3_4;
}
// Step 3. If CheckHyphens, the label must neither begin nor end with a U+002D
// HYPHEN-MINUS character.
if ('-' === substr($label, 0, 1)) {
$info->errors |= self::ERROR_LEADING_HYPHEN;
}
if ('-' === substr($label, -1, 1)) {
$info->errors |= self::ERROR_TRAILING_HYPHEN;
}
}
// Step 4. The label must not contain a U+002E (.) FULL STOP.
if (false !== strpos($label, '.')) {
$info->errors |= self::ERROR_LABEL_HAS_DOT;
}
// Step 5. The label must not begin with a combining mark, that is: General_Category=Mark.
if (1 === preg_match(Regex::COMBINING_MARK, $label)) {
$info->errors |= self::ERROR_LEADING_COMBINING_MARK;
}
// Step 6. Each code point in the label must only have certain status values according to
// Section 5, IDNA Mapping Table:
$transitional = $options['Transitional_Processing'];
$useSTD3ASCIIRules = $options['UseSTD3ASCIIRules'];
foreach ($codePoints as $codePoint) {
$data = self::lookupCodePointStatus($codePoint, $useSTD3ASCIIRules);
$status = $data['status'];
if ('valid' === $status || (!$transitional && 'deviation' === $status)) {
continue;
}
$info->errors |= self::ERROR_DISALLOWED;
break;
}
// Step 7. If CheckJoiners, the label must satisify the ContextJ rules from Appendix A, in
// The Unicode Code Points and Internationalized Domain Names for Applications (IDNA)
// [IDNA2008].
if ($options['CheckJoiners'] && !self::isValidContextJ($codePoints, $label)) {
$info->errors |= self::ERROR_CONTEXTJ;
}
// Step 8. If CheckBidi, and if the domain name is a Bidi domain name, then the label must
// satisfy all six of the numbered conditions in [IDNA2008] RFC 5893, Section 2.
if ($options['CheckBidi'] && (!$info->bidiDomain || $info->validBidiDomain)) {
self::validateBidiLabel($label, $info);
}
}
/**
* @see https://tools.ietf.org/html/rfc3492#section-6.2
*
* @param string $input
*
* @return string
*/
private static function punycodeDecode($input)
{
$n = self::INITIAL_N;
$out = 0;
$i = 0;
$bias = self::INITIAL_BIAS;
$lastDelimIndex = strrpos($input, self::DELIMITER);
$b = false === $lastDelimIndex ? 0 : $lastDelimIndex;
$inputLength = \strlen($input);
$output = [];
$bytes = array_map('ord', str_split($input));
for ($j = 0; $j < $b; ++$j) {
if ($bytes[$j] > 0x7F) {
throw new \Exception('Invalid input');
}
$output[$out++] = $input[$j];
}
if ($b > 0) {
++$b;
}
for ($in = $b; $in < $inputLength; ++$out) {
$oldi = $i;
$w = 1;
for ($k = self::BASE; /* no condition */; $k += self::BASE) {
if ($in >= $inputLength) {
throw new \Exception('Invalid input');
}
$digit = self::$basicToDigit[$bytes[$in++] & 0xFF];
if ($digit < 0) {
throw new \Exception('Invalid input');
}
if ($digit > intdiv(self::MAX_INT - $i, $w)) {
throw new \Exception('Integer overflow');
}
$i += $digit * $w;
if ($k <= $bias) {
$t = self::TMIN;
} elseif ($k >= $bias + self::TMAX) {
$t = self::TMAX;
} else {
$t = $k - $bias;
}
if ($digit < $t) {
break;
}
$baseMinusT = self::BASE - $t;
if ($w > intdiv(self::MAX_INT, $baseMinusT)) {
throw new \Exception('Integer overflow');
}
$w *= $baseMinusT;
}
$outPlusOne = $out + 1;
$bias = self::adaptBias($i - $oldi, $outPlusOne, 0 === $oldi);
if (intdiv($i, $outPlusOne) > self::MAX_INT - $n) {
throw new \Exception('Integer overflow');
}
$n += intdiv($i, $outPlusOne);
$i %= $outPlusOne;
array_splice($output, $i++, 0, [mb_chr($n, 'utf-8')]);
}
return implode('', $output);
}
/**
* @see https://tools.ietf.org/html/rfc3492#section-6.3
*
* @param string $input
*
* @return string
*/
private static function punycodeEncode($input)
{
$n = self::INITIAL_N;
$delta = 0;
$out = 0;
$bias = self::INITIAL_BIAS;
$inputLength = 0;
$output = '';
$iter = self::utf8Decode($input);
foreach ($iter as $codePoint) {
++$inputLength;
if ($codePoint < 0x80) {
$output .= \chr($codePoint);
++$out;
}
}
$h = $out;
$b = $out;
if ($b > 0) {
$output .= self::DELIMITER;
++$out;
}
while ($h < $inputLength) {
$m = self::MAX_INT;
foreach ($iter as $codePoint) {
if ($codePoint >= $n && $codePoint < $m) {
$m = $codePoint;
}
}
if ($m - $n > intdiv(self::MAX_INT - $delta, $h + 1)) {
throw new \Exception('Integer overflow');
}
$delta += ($m - $n) * ($h + 1);
$n = $m;
foreach ($iter as $codePoint) {
if ($codePoint < $n && 0 === ++$delta) {
throw new \Exception('Integer overflow');
}
if ($codePoint === $n) {
$q = $delta;
for ($k = self::BASE; /* no condition */; $k += self::BASE) {
if ($k <= $bias) {
$t = self::TMIN;
} elseif ($k >= $bias + self::TMAX) {
$t = self::TMAX;
} else {
$t = $k - $bias;
}
if ($q < $t) {
break;
}
$qMinusT = $q - $t;
$baseMinusT = self::BASE - $t;
$output .= self::encodeDigit($t + $qMinusT % $baseMinusT, false);
++$out;
$q = intdiv($qMinusT, $baseMinusT);
}
$output .= self::encodeDigit($q, false);
++$out;
$bias = self::adaptBias($delta, $h + 1, $h === $b);
$delta = 0;
++$h;
}
}
++$delta;
++$n;
}
return $output;
}
/**
* @see https://tools.ietf.org/html/rfc3492#section-6.1
*
* @param int $delta
* @param int $numPoints
* @param bool $firstTime
*
* @return int
*/
private static function adaptBias($delta, $numPoints, $firstTime)
{
// xxx >> 1 is a faster way of doing intdiv(xxx, 2)
$delta = $firstTime ? intdiv($delta, self::DAMP) : $delta >> 1;
$delta += intdiv($delta, $numPoints);
$k = 0;
while ($delta > ((self::BASE - self::TMIN) * self::TMAX) >> 1) {
$delta = intdiv($delta, self::BASE - self::TMIN);
$k += self::BASE;
}
return $k + intdiv((self::BASE - self::TMIN + 1) * $delta, $delta + self::SKEW);
}
/**
* @param int $d
* @param bool $flag
*
* @return string
*/
private static function encodeDigit($d, $flag)
{
return \chr($d + 22 + 75 * ($d < 26 ? 1 : 0) - (($flag ? 1 : 0) << 5));
}
/**
* Takes a UTF-8 encoded string and converts it into a series of integer code points. Any
* invalid byte sequences will be replaced by a U+FFFD replacement code point.
*
* @see https://encoding.spec.whatwg.org/#utf-8-decoder
*
* @param string $input
*
* @return array<int, int>
*/
private static function utf8Decode($input)
{
$bytesSeen = 0;
$bytesNeeded = 0;
$lowerBoundary = 0x80;
$upperBoundary = 0xBF;
$codePoint = 0;
$codePoints = [];
$length = \strlen($input);
for ($i = 0; $i < $length; ++$i) {
$byte = \ord($input[$i]);
if (0 === $bytesNeeded) {
if ($byte >= 0x00 && $byte <= 0x7F) {
$codePoints[] = $byte;
continue;
}
if ($byte >= 0xC2 && $byte <= 0xDF) {
$bytesNeeded = 1;
$codePoint = $byte & 0x1F;
} elseif ($byte >= 0xE0 && $byte <= 0xEF) {
if (0xE0 === $byte) {
$lowerBoundary = 0xA0;
} elseif (0xED === $byte) {
$upperBoundary = 0x9F;
}
$bytesNeeded = 2;
$codePoint = $byte & 0xF;
} elseif ($byte >= 0xF0 && $byte <= 0xF4) {
if (0xF0 === $byte) {
$lowerBoundary = 0x90;
} elseif (0xF4 === $byte) {
$upperBoundary = 0x8F;
}
$bytesNeeded = 3;
$codePoint = $byte & 0x7;
} else {
$codePoints[] = 0xFFFD;
}
continue;
}
if ($byte < $lowerBoundary || $byte > $upperBoundary) {
$codePoint = 0;
$bytesNeeded = 0;
$bytesSeen = 0;
$lowerBoundary = 0x80;
$upperBoundary = 0xBF;
--$i;
$codePoints[] = 0xFFFD;
continue;
}
$lowerBoundary = 0x80;
$upperBoundary = 0xBF;
$codePoint = ($codePoint << 6) | ($byte & 0x3F);
if (++$bytesSeen !== $bytesNeeded) {
continue;
}
$codePoints[] = $codePoint;
$codePoint = 0;
$bytesNeeded = 0;
$bytesSeen = 0;
}
// String unexpectedly ended, so append a U+FFFD code point.
if (0 !== $bytesNeeded) {
$codePoints[] = 0xFFFD;
}
return $codePoints;
}
/**
* @param int $codePoint
* @param bool $useSTD3ASCIIRules
*
* @return array{status: string, mapping?: string}
*/
private static function lookupCodePointStatus($codePoint, $useSTD3ASCIIRules)
{
if (!self::$mappingTableLoaded) {
self::$mappingTableLoaded = true;
self::$mapped = require __DIR__.'/Resources/unidata/mapped.php';
self::$ignored = require __DIR__.'/Resources/unidata/ignored.php';
self::$deviation = require __DIR__.'/Resources/unidata/deviation.php';
self::$disallowed = require __DIR__.'/Resources/unidata/disallowed.php';
self::$disallowed_STD3_mapped = require __DIR__.'/Resources/unidata/disallowed_STD3_mapped.php';
self::$disallowed_STD3_valid = require __DIR__.'/Resources/unidata/disallowed_STD3_valid.php';
}
if (isset(self::$mapped[$codePoint])) {
return ['status' => 'mapped', 'mapping' => self::$mapped[$codePoint]];
}
if (isset(self::$ignored[$codePoint])) {
return ['status' => 'ignored'];
}
if (isset(self::$deviation[$codePoint])) {
return ['status' => 'deviation', 'mapping' => self::$deviation[$codePoint]];
}
if (isset(self::$disallowed[$codePoint]) || DisallowedRanges::inRange($codePoint)) {
return ['status' => 'disallowed'];
}
$isDisallowedMapped = isset(self::$disallowed_STD3_mapped[$codePoint]);
if ($isDisallowedMapped || isset(self::$disallowed_STD3_valid[$codePoint])) {
$status = 'disallowed';
if (!$useSTD3ASCIIRules) {
$status = $isDisallowedMapped ? 'mapped' : 'valid';
}
if ($isDisallowedMapped) {
return ['status' => $status, 'mapping' => self::$disallowed_STD3_mapped[$codePoint]];
}
return ['status' => $status];
}
return ['status' => 'valid'];
}
}

View File

@ -0,0 +1,23 @@
<?php
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com> and Trevor Rowbotham <trevor.rowbotham@pm.me>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Polyfill\Intl\Idn;
/**
* @internal
*/
class Info
{
public $bidiDomain = false;
public $errors = 0;
public $validBidiDomain = true;
public $transitionalDifferent = false;
}

View File

@ -0,0 +1,19 @@
Copyright (c) 2018-present Fabien Potencier and Trevor Rowbotham <trevor.rowbotham@pm.me>
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is furnished
to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.

View File

@ -0,0 +1,12 @@
Symfony Polyfill / Intl: Idn
============================
This component provides [`idn_to_ascii`](https://php.net/idn-to-ascii) and [`idn_to_utf8`](https://php.net/idn-to-utf8) functions to users who run php versions without the [Intl](https://php.net/intl) extension.
More information can be found in the
[main Polyfill README](https://github.com/symfony/polyfill/blob/main/README.md).
License
=======
This library is released under the [MIT license](LICENSE).

View File

@ -0,0 +1,384 @@
<?php
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Polyfill\Intl\Idn\Resources\unidata;
/**
* @internal
*/
final class DisallowedRanges
{
/**
* @param int $codePoint
*
* @return bool
*/
public static function inRange($codePoint)
{
if ($codePoint >= 128 && $codePoint <= 159) {
return true;
}
if ($codePoint >= 2155 && $codePoint <= 2207) {
return true;
}
if ($codePoint >= 3676 && $codePoint <= 3712) {
return true;
}
if ($codePoint >= 3808 && $codePoint <= 3839) {
return true;
}
if ($codePoint >= 4059 && $codePoint <= 4095) {
return true;
}
if ($codePoint >= 4256 && $codePoint <= 4293) {
return true;
}
if ($codePoint >= 6849 && $codePoint <= 6911) {
return true;
}
if ($codePoint >= 11859 && $codePoint <= 11903) {
return true;
}
if ($codePoint >= 42955 && $codePoint <= 42996) {
return true;
}
if ($codePoint >= 55296 && $codePoint <= 57343) {
return true;
}
if ($codePoint >= 57344 && $codePoint <= 63743) {
return true;
}
if ($codePoint >= 64218 && $codePoint <= 64255) {
return true;
}
if ($codePoint >= 64976 && $codePoint <= 65007) {
return true;
}
if ($codePoint >= 65630 && $codePoint <= 65663) {
return true;
}
if ($codePoint >= 65953 && $codePoint <= 65999) {
return true;
}
if ($codePoint >= 66046 && $codePoint <= 66175) {
return true;
}
if ($codePoint >= 66518 && $codePoint <= 66559) {
return true;
}
if ($codePoint >= 66928 && $codePoint <= 67071) {
return true;
}
if ($codePoint >= 67432 && $codePoint <= 67583) {
return true;
}
if ($codePoint >= 67760 && $codePoint <= 67807) {
return true;
}
if ($codePoint >= 67904 && $codePoint <= 67967) {
return true;
}
if ($codePoint >= 68256 && $codePoint <= 68287) {
return true;
}
if ($codePoint >= 68528 && $codePoint <= 68607) {
return true;
}
if ($codePoint >= 68681 && $codePoint <= 68735) {
return true;
}
if ($codePoint >= 68922 && $codePoint <= 69215) {
return true;
}
if ($codePoint >= 69298 && $codePoint <= 69375) {
return true;
}
if ($codePoint >= 69466 && $codePoint <= 69551) {
return true;
}
if ($codePoint >= 70207 && $codePoint <= 70271) {
return true;
}
if ($codePoint >= 70517 && $codePoint <= 70655) {
return true;
}
if ($codePoint >= 70874 && $codePoint <= 71039) {
return true;
}
if ($codePoint >= 71134 && $codePoint <= 71167) {
return true;
}
if ($codePoint >= 71370 && $codePoint <= 71423) {
return true;
}
if ($codePoint >= 71488 && $codePoint <= 71679) {
return true;
}
if ($codePoint >= 71740 && $codePoint <= 71839) {
return true;
}
if ($codePoint >= 72026 && $codePoint <= 72095) {
return true;
}
if ($codePoint >= 72441 && $codePoint <= 72703) {
return true;
}
if ($codePoint >= 72887 && $codePoint <= 72959) {
return true;
}
if ($codePoint >= 73130 && $codePoint <= 73439) {
return true;
}
if ($codePoint >= 73465 && $codePoint <= 73647) {
return true;
}
if ($codePoint >= 74650 && $codePoint <= 74751) {
return true;
}
if ($codePoint >= 75076 && $codePoint <= 77823) {
return true;
}
if ($codePoint >= 78905 && $codePoint <= 82943) {
return true;
}
if ($codePoint >= 83527 && $codePoint <= 92159) {
return true;
}
if ($codePoint >= 92784 && $codePoint <= 92879) {
return true;
}
if ($codePoint >= 93072 && $codePoint <= 93759) {
return true;
}
if ($codePoint >= 93851 && $codePoint <= 93951) {
return true;
}
if ($codePoint >= 94112 && $codePoint <= 94175) {
return true;
}
if ($codePoint >= 101590 && $codePoint <= 101631) {
return true;
}
if ($codePoint >= 101641 && $codePoint <= 110591) {
return true;
}
if ($codePoint >= 110879 && $codePoint <= 110927) {
return true;
}
if ($codePoint >= 111356 && $codePoint <= 113663) {
return true;
}
if ($codePoint >= 113828 && $codePoint <= 118783) {
return true;
}
if ($codePoint >= 119366 && $codePoint <= 119519) {
return true;
}
if ($codePoint >= 119673 && $codePoint <= 119807) {
return true;
}
if ($codePoint >= 121520 && $codePoint <= 122879) {
return true;
}
if ($codePoint >= 122923 && $codePoint <= 123135) {
return true;
}
if ($codePoint >= 123216 && $codePoint <= 123583) {
return true;
}
if ($codePoint >= 123648 && $codePoint <= 124927) {
return true;
}
if ($codePoint >= 125143 && $codePoint <= 125183) {
return true;
}
if ($codePoint >= 125280 && $codePoint <= 126064) {
return true;
}
if ($codePoint >= 126133 && $codePoint <= 126208) {
return true;
}
if ($codePoint >= 126270 && $codePoint <= 126463) {
return true;
}
if ($codePoint >= 126652 && $codePoint <= 126703) {
return true;
}
if ($codePoint >= 126706 && $codePoint <= 126975) {
return true;
}
if ($codePoint >= 127406 && $codePoint <= 127461) {
return true;
}
if ($codePoint >= 127590 && $codePoint <= 127743) {
return true;
}
if ($codePoint >= 129202 && $codePoint <= 129279) {
return true;
}
if ($codePoint >= 129751 && $codePoint <= 129791) {
return true;
}
if ($codePoint >= 129995 && $codePoint <= 130031) {
return true;
}
if ($codePoint >= 130042 && $codePoint <= 131069) {
return true;
}
if ($codePoint >= 173790 && $codePoint <= 173823) {
return true;
}
if ($codePoint >= 191457 && $codePoint <= 194559) {
return true;
}
if ($codePoint >= 195102 && $codePoint <= 196605) {
return true;
}
if ($codePoint >= 201547 && $codePoint <= 262141) {
return true;
}
if ($codePoint >= 262144 && $codePoint <= 327677) {
return true;
}
if ($codePoint >= 327680 && $codePoint <= 393213) {
return true;
}
if ($codePoint >= 393216 && $codePoint <= 458749) {
return true;
}
if ($codePoint >= 458752 && $codePoint <= 524285) {
return true;
}
if ($codePoint >= 524288 && $codePoint <= 589821) {
return true;
}
if ($codePoint >= 589824 && $codePoint <= 655357) {
return true;
}
if ($codePoint >= 655360 && $codePoint <= 720893) {
return true;
}
if ($codePoint >= 720896 && $codePoint <= 786429) {
return true;
}
if ($codePoint >= 786432 && $codePoint <= 851965) {
return true;
}
if ($codePoint >= 851968 && $codePoint <= 917501) {
return true;
}
if ($codePoint >= 917536 && $codePoint <= 917631) {
return true;
}
if ($codePoint >= 917632 && $codePoint <= 917759) {
return true;
}
if ($codePoint >= 918000 && $codePoint <= 983037) {
return true;
}
if ($codePoint >= 983040 && $codePoint <= 1048573) {
return true;
}
if ($codePoint >= 1048576 && $codePoint <= 1114109) {
return true;
}
return false;
}
}

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,8 @@
<?php
return array (
223 => 'ss',
962 => 'σ',
8204 => '',
8205 => '',
);

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,308 @@
<?php
return array (
160 => ' ',
168 => ' ̈',
175 => ' ̄',
180 => ' ́',
184 => ' ̧',
728 => ' ̆',
729 => ' ̇',
730 => ' ̊',
731 => ' ̨',
732 => ' ̃',
733 => ' ̋',
890 => ' ι',
894 => ';',
900 => ' ́',
901 => ' ̈́',
8125 => ' ̓',
8127 => ' ̓',
8128 => ' ͂',
8129 => ' ̈͂',
8141 => ' ̓̀',
8142 => ' ̓́',
8143 => ' ̓͂',
8157 => ' ̔̀',
8158 => ' ̔́',
8159 => ' ̔͂',
8173 => ' ̈̀',
8174 => ' ̈́',
8175 => '`',
8189 => ' ́',
8190 => ' ̔',
8192 => ' ',
8193 => ' ',
8194 => ' ',
8195 => ' ',
8196 => ' ',
8197 => ' ',
8198 => ' ',
8199 => ' ',
8200 => ' ',
8201 => ' ',
8202 => ' ',
8215 => ' ̳',
8239 => ' ',
8252 => '!!',
8254 => ' ̅',
8263 => '??',
8264 => '?!',
8265 => '!?',
8287 => ' ',
8314 => '+',
8316 => '=',
8317 => '(',
8318 => ')',
8330 => '+',
8332 => '=',
8333 => '(',
8334 => ')',
8448 => 'a/c',
8449 => 'a/s',
8453 => 'c/o',
8454 => 'c/u',
9332 => '(1)',
9333 => '(2)',
9334 => '(3)',
9335 => '(4)',
9336 => '(5)',
9337 => '(6)',
9338 => '(7)',
9339 => '(8)',
9340 => '(9)',
9341 => '(10)',
9342 => '(11)',
9343 => '(12)',
9344 => '(13)',
9345 => '(14)',
9346 => '(15)',
9347 => '(16)',
9348 => '(17)',
9349 => '(18)',
9350 => '(19)',
9351 => '(20)',
9372 => '(a)',
9373 => '(b)',
9374 => '(c)',
9375 => '(d)',
9376 => '(e)',
9377 => '(f)',
9378 => '(g)',
9379 => '(h)',
9380 => '(i)',
9381 => '(j)',
9382 => '(k)',
9383 => '(l)',
9384 => '(m)',
9385 => '(n)',
9386 => '(o)',
9387 => '(p)',
9388 => '(q)',
9389 => '(r)',
9390 => '(s)',
9391 => '(t)',
9392 => '(u)',
9393 => '(v)',
9394 => '(w)',
9395 => '(x)',
9396 => '(y)',
9397 => '(z)',
10868 => '::=',
10869 => '==',
10870 => '===',
12288 => ' ',
12443 => ' ゙',
12444 => ' ゚',
12800 => '(ᄀ)',
12801 => '(ᄂ)',
12802 => '(ᄃ)',
12803 => '(ᄅ)',
12804 => '(ᄆ)',
12805 => '(ᄇ)',
12806 => '(ᄉ)',
12807 => '(ᄋ)',
12808 => '(ᄌ)',
12809 => '(ᄎ)',
12810 => '(ᄏ)',
12811 => '(ᄐ)',
12812 => '(ᄑ)',
12813 => '(ᄒ)',
12814 => '(가)',
12815 => '(나)',
12816 => '(다)',
12817 => '(라)',
12818 => '(마)',
12819 => '(바)',
12820 => '(사)',
12821 => '(아)',
12822 => '(자)',
12823 => '(차)',
12824 => '(카)',
12825 => '(타)',
12826 => '(파)',
12827 => '(하)',
12828 => '(주)',
12829 => '(오전)',
12830 => '(오후)',
12832 => '(一)',
12833 => '(二)',
12834 => '(三)',
12835 => '(四)',
12836 => '(五)',
12837 => '(六)',
12838 => '(七)',
12839 => '(八)',
12840 => '(九)',
12841 => '(十)',
12842 => '(月)',
12843 => '(火)',
12844 => '(水)',
12845 => '(木)',
12846 => '(金)',
12847 => '(土)',
12848 => '(日)',
12849 => '(株)',
12850 => '(有)',
12851 => '(社)',
12852 => '(名)',
12853 => '(特)',
12854 => '(財)',
12855 => '(祝)',
12856 => '(労)',
12857 => '(代)',
12858 => '(呼)',
12859 => '(学)',
12860 => '(監)',
12861 => '(企)',
12862 => '(資)',
12863 => '(協)',
12864 => '(祭)',
12865 => '(休)',
12866 => '(自)',
12867 => '(至)',
64297 => '+',
64606 => ' ٌّ',
64607 => ' ٍّ',
64608 => ' َّ',
64609 => ' ُّ',
64610 => ' ِّ',
64611 => ' ّٰ',
65018 => 'صلى الله عليه وسلم',
65019 => 'جل جلاله',
65040 => ',',
65043 => ':',
65044 => ';',
65045 => '!',
65046 => '?',
65075 => '_',
65076 => '_',
65077 => '(',
65078 => ')',
65079 => '{',
65080 => '}',
65095 => '[',
65096 => ']',
65097 => ' ̅',
65098 => ' ̅',
65099 => ' ̅',
65100 => ' ̅',
65101 => '_',
65102 => '_',
65103 => '_',
65104 => ',',
65108 => ';',
65109 => ':',
65110 => '?',
65111 => '!',
65113 => '(',
65114 => ')',
65115 => '{',
65116 => '}',
65119 => '#',
65120 => '&',
65121 => '*',
65122 => '+',
65124 => '<',
65125 => '>',
65126 => '=',
65128 => '\\',
65129 => '$',
65130 => '%',
65131 => '@',
65136 => ' ً',
65138 => ' ٌ',
65140 => ' ٍ',
65142 => ' َ',
65144 => ' ُ',
65146 => ' ِ',
65148 => ' ّ',
65150 => ' ْ',
65281 => '!',
65282 => '"',
65283 => '#',
65284 => '$',
65285 => '%',
65286 => '&',
65287 => '\'',
65288 => '(',
65289 => ')',
65290 => '*',
65291 => '+',
65292 => ',',
65295 => '/',
65306 => ':',
65307 => ';',
65308 => '<',
65309 => '=',
65310 => '>',
65311 => '?',
65312 => '@',
65339 => '[',
65340 => '\\',
65341 => ']',
65342 => '^',
65343 => '_',
65344 => '`',
65371 => '{',
65372 => '|',
65373 => '}',
65374 => '~',
65507 => ' ̄',
127233 => '0,',
127234 => '1,',
127235 => '2,',
127236 => '3,',
127237 => '4,',
127238 => '5,',
127239 => '6,',
127240 => '7,',
127241 => '8,',
127242 => '9,',
127248 => '(a)',
127249 => '(b)',
127250 => '(c)',
127251 => '(d)',
127252 => '(e)',
127253 => '(f)',
127254 => '(g)',
127255 => '(h)',
127256 => '(i)',
127257 => '(j)',
127258 => '(k)',
127259 => '(l)',
127260 => '(m)',
127261 => '(n)',
127262 => '(o)',
127263 => '(p)',
127264 => '(q)',
127265 => '(r)',
127266 => '(s)',
127267 => '(t)',
127268 => '(u)',
127269 => '(v)',
127270 => '(w)',
127271 => '(x)',
127272 => '(y)',
127273 => '(z)',
);

View File

@ -0,0 +1,71 @@
<?php
return array (
0 => true,
1 => true,
2 => true,
3 => true,
4 => true,
5 => true,
6 => true,
7 => true,
8 => true,
9 => true,
10 => true,
11 => true,
12 => true,
13 => true,
14 => true,
15 => true,
16 => true,
17 => true,
18 => true,
19 => true,
20 => true,
21 => true,
22 => true,
23 => true,
24 => true,
25 => true,
26 => true,
27 => true,
28 => true,
29 => true,
30 => true,
31 => true,
32 => true,
33 => true,
34 => true,
35 => true,
36 => true,
37 => true,
38 => true,
39 => true,
40 => true,
41 => true,
42 => true,
43 => true,
44 => true,
47 => true,
58 => true,
59 => true,
60 => true,
61 => true,
62 => true,
63 => true,
64 => true,
91 => true,
92 => true,
93 => true,
94 => true,
95 => true,
96 => true,
123 => true,
124 => true,
125 => true,
126 => true,
127 => true,
8800 => true,
8814 => true,
8815 => true,
);

View File

@ -0,0 +1,273 @@
<?php
return array (
173 => true,
847 => true,
6155 => true,
6156 => true,
6157 => true,
8203 => true,
8288 => true,
8292 => true,
65024 => true,
65025 => true,
65026 => true,
65027 => true,
65028 => true,
65029 => true,
65030 => true,
65031 => true,
65032 => true,
65033 => true,
65034 => true,
65035 => true,
65036 => true,
65037 => true,
65038 => true,
65039 => true,
65279 => true,
113824 => true,
113825 => true,
113826 => true,
113827 => true,
917760 => true,
917761 => true,
917762 => true,
917763 => true,
917764 => true,
917765 => true,
917766 => true,
917767 => true,
917768 => true,
917769 => true,
917770 => true,
917771 => true,
917772 => true,
917773 => true,
917774 => true,
917775 => true,
917776 => true,
917777 => true,
917778 => true,
917779 => true,
917780 => true,
917781 => true,
917782 => true,
917783 => true,
917784 => true,
917785 => true,
917786 => true,
917787 => true,
917788 => true,
917789 => true,
917790 => true,
917791 => true,
917792 => true,
917793 => true,
917794 => true,
917795 => true,
917796 => true,
917797 => true,
917798 => true,
917799 => true,
917800 => true,
917801 => true,
917802 => true,
917803 => true,
917804 => true,
917805 => true,
917806 => true,
917807 => true,
917808 => true,
917809 => true,
917810 => true,
917811 => true,
917812 => true,
917813 => true,
917814 => true,
917815 => true,
917816 => true,
917817 => true,
917818 => true,
917819 => true,
917820 => true,
917821 => true,
917822 => true,
917823 => true,
917824 => true,
917825 => true,
917826 => true,
917827 => true,
917828 => true,
917829 => true,
917830 => true,
917831 => true,
917832 => true,
917833 => true,
917834 => true,
917835 => true,
917836 => true,
917837 => true,
917838 => true,
917839 => true,
917840 => true,
917841 => true,
917842 => true,
917843 => true,
917844 => true,
917845 => true,
917846 => true,
917847 => true,
917848 => true,
917849 => true,
917850 => true,
917851 => true,
917852 => true,
917853 => true,
917854 => true,
917855 => true,
917856 => true,
917857 => true,
917858 => true,
917859 => true,
917860 => true,
917861 => true,
917862 => true,
917863 => true,
917864 => true,
917865 => true,
917866 => true,
917867 => true,
917868 => true,
917869 => true,
917870 => true,
917871 => true,
917872 => true,
917873 => true,
917874 => true,
917875 => true,
917876 => true,
917877 => true,
917878 => true,
917879 => true,
917880 => true,
917881 => true,
917882 => true,
917883 => true,
917884 => true,
917885 => true,
917886 => true,
917887 => true,
917888 => true,
917889 => true,
917890 => true,
917891 => true,
917892 => true,
917893 => true,
917894 => true,
917895 => true,
917896 => true,
917897 => true,
917898 => true,
917899 => true,
917900 => true,
917901 => true,
917902 => true,
917903 => true,
917904 => true,
917905 => true,
917906 => true,
917907 => true,
917908 => true,
917909 => true,
917910 => true,
917911 => true,
917912 => true,
917913 => true,
917914 => true,
917915 => true,
917916 => true,
917917 => true,
917918 => true,
917919 => true,
917920 => true,
917921 => true,
917922 => true,
917923 => true,
917924 => true,
917925 => true,
917926 => true,
917927 => true,
917928 => true,
917929 => true,
917930 => true,
917931 => true,
917932 => true,
917933 => true,
917934 => true,
917935 => true,
917936 => true,
917937 => true,
917938 => true,
917939 => true,
917940 => true,
917941 => true,
917942 => true,
917943 => true,
917944 => true,
917945 => true,
917946 => true,
917947 => true,
917948 => true,
917949 => true,
917950 => true,
917951 => true,
917952 => true,
917953 => true,
917954 => true,
917955 => true,
917956 => true,
917957 => true,
917958 => true,
917959 => true,
917960 => true,
917961 => true,
917962 => true,
917963 => true,
917964 => true,
917965 => true,
917966 => true,
917967 => true,
917968 => true,
917969 => true,
917970 => true,
917971 => true,
917972 => true,
917973 => true,
917974 => true,
917975 => true,
917976 => true,
917977 => true,
917978 => true,
917979 => true,
917980 => true,
917981 => true,
917982 => true,
917983 => true,
917984 => true,
917985 => true,
917986 => true,
917987 => true,
917988 => true,
917989 => true,
917990 => true,
917991 => true,
917992 => true,
917993 => true,
917994 => true,
917995 => true,
917996 => true,
917997 => true,
917998 => true,
917999 => true,
);

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,65 @@
<?php
return array (
2381 => 9,
2509 => 9,
2637 => 9,
2765 => 9,
2893 => 9,
3021 => 9,
3149 => 9,
3277 => 9,
3387 => 9,
3388 => 9,
3405 => 9,
3530 => 9,
3642 => 9,
3770 => 9,
3972 => 9,
4153 => 9,
4154 => 9,
5908 => 9,
5940 => 9,
6098 => 9,
6752 => 9,
6980 => 9,
7082 => 9,
7083 => 9,
7154 => 9,
7155 => 9,
11647 => 9,
43014 => 9,
43052 => 9,
43204 => 9,
43347 => 9,
43456 => 9,
43766 => 9,
44013 => 9,
68159 => 9,
69702 => 9,
69759 => 9,
69817 => 9,
69939 => 9,
69940 => 9,
70080 => 9,
70197 => 9,
70378 => 9,
70477 => 9,
70722 => 9,
70850 => 9,
71103 => 9,
71231 => 9,
71350 => 9,
71467 => 9,
71737 => 9,
71997 => 9,
71998 => 9,
72160 => 9,
72244 => 9,
72263 => 9,
72345 => 9,
72767 => 9,
73028 => 9,
73029 => 9,
73111 => 9,
);

View File

@ -0,0 +1,145 @@
<?php
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
use Symfony\Polyfill\Intl\Idn as p;
if (extension_loaded('intl')) {
return;
}
if (\PHP_VERSION_ID >= 80000) {
return require __DIR__.'/bootstrap80.php';
}
if (!defined('U_IDNA_PROHIBITED_ERROR')) {
define('U_IDNA_PROHIBITED_ERROR', 66560);
}
if (!defined('U_IDNA_ERROR_START')) {
define('U_IDNA_ERROR_START', 66560);
}
if (!defined('U_IDNA_UNASSIGNED_ERROR')) {
define('U_IDNA_UNASSIGNED_ERROR', 66561);
}
if (!defined('U_IDNA_CHECK_BIDI_ERROR')) {
define('U_IDNA_CHECK_BIDI_ERROR', 66562);
}
if (!defined('U_IDNA_STD3_ASCII_RULES_ERROR')) {
define('U_IDNA_STD3_ASCII_RULES_ERROR', 66563);
}
if (!defined('U_IDNA_ACE_PREFIX_ERROR')) {
define('U_IDNA_ACE_PREFIX_ERROR', 66564);
}
if (!defined('U_IDNA_VERIFICATION_ERROR')) {
define('U_IDNA_VERIFICATION_ERROR', 66565);
}
if (!defined('U_IDNA_LABEL_TOO_LONG_ERROR')) {
define('U_IDNA_LABEL_TOO_LONG_ERROR', 66566);
}
if (!defined('U_IDNA_ZERO_LENGTH_LABEL_ERROR')) {
define('U_IDNA_ZERO_LENGTH_LABEL_ERROR', 66567);
}
if (!defined('U_IDNA_DOMAIN_NAME_TOO_LONG_ERROR')) {
define('U_IDNA_DOMAIN_NAME_TOO_LONG_ERROR', 66568);
}
if (!defined('U_IDNA_ERROR_LIMIT')) {
define('U_IDNA_ERROR_LIMIT', 66569);
}
if (!defined('U_STRINGPREP_PROHIBITED_ERROR')) {
define('U_STRINGPREP_PROHIBITED_ERROR', 66560);
}
if (!defined('U_STRINGPREP_UNASSIGNED_ERROR')) {
define('U_STRINGPREP_UNASSIGNED_ERROR', 66561);
}
if (!defined('U_STRINGPREP_CHECK_BIDI_ERROR')) {
define('U_STRINGPREP_CHECK_BIDI_ERROR', 66562);
}
if (!defined('IDNA_DEFAULT')) {
define('IDNA_DEFAULT', 0);
}
if (!defined('IDNA_ALLOW_UNASSIGNED')) {
define('IDNA_ALLOW_UNASSIGNED', 1);
}
if (!defined('IDNA_USE_STD3_RULES')) {
define('IDNA_USE_STD3_RULES', 2);
}
if (!defined('IDNA_CHECK_BIDI')) {
define('IDNA_CHECK_BIDI', 4);
}
if (!defined('IDNA_CHECK_CONTEXTJ')) {
define('IDNA_CHECK_CONTEXTJ', 8);
}
if (!defined('IDNA_NONTRANSITIONAL_TO_ASCII')) {
define('IDNA_NONTRANSITIONAL_TO_ASCII', 16);
}
if (!defined('IDNA_NONTRANSITIONAL_TO_UNICODE')) {
define('IDNA_NONTRANSITIONAL_TO_UNICODE', 32);
}
if (!defined('INTL_IDNA_VARIANT_2003')) {
define('INTL_IDNA_VARIANT_2003', 0);
}
if (!defined('INTL_IDNA_VARIANT_UTS46')) {
define('INTL_IDNA_VARIANT_UTS46', 1);
}
if (!defined('IDNA_ERROR_EMPTY_LABEL')) {
define('IDNA_ERROR_EMPTY_LABEL', 1);
}
if (!defined('IDNA_ERROR_LABEL_TOO_LONG')) {
define('IDNA_ERROR_LABEL_TOO_LONG', 2);
}
if (!defined('IDNA_ERROR_DOMAIN_NAME_TOO_LONG')) {
define('IDNA_ERROR_DOMAIN_NAME_TOO_LONG', 4);
}
if (!defined('IDNA_ERROR_LEADING_HYPHEN')) {
define('IDNA_ERROR_LEADING_HYPHEN', 8);
}
if (!defined('IDNA_ERROR_TRAILING_HYPHEN')) {
define('IDNA_ERROR_TRAILING_HYPHEN', 16);
}
if (!defined('IDNA_ERROR_HYPHEN_3_4')) {
define('IDNA_ERROR_HYPHEN_3_4', 32);
}
if (!defined('IDNA_ERROR_LEADING_COMBINING_MARK')) {
define('IDNA_ERROR_LEADING_COMBINING_MARK', 64);
}
if (!defined('IDNA_ERROR_DISALLOWED')) {
define('IDNA_ERROR_DISALLOWED', 128);
}
if (!defined('IDNA_ERROR_PUNYCODE')) {
define('IDNA_ERROR_PUNYCODE', 256);
}
if (!defined('IDNA_ERROR_LABEL_HAS_DOT')) {
define('IDNA_ERROR_LABEL_HAS_DOT', 512);
}
if (!defined('IDNA_ERROR_INVALID_ACE_LABEL')) {
define('IDNA_ERROR_INVALID_ACE_LABEL', 1024);
}
if (!defined('IDNA_ERROR_BIDI')) {
define('IDNA_ERROR_BIDI', 2048);
}
if (!defined('IDNA_ERROR_CONTEXTJ')) {
define('IDNA_ERROR_CONTEXTJ', 4096);
}
if (\PHP_VERSION_ID < 70400) {
if (!function_exists('idn_to_ascii')) {
function idn_to_ascii($domain, $flags = 0, $variant = \INTL_IDNA_VARIANT_2003, &$idna_info = null) { return p\Idn::idn_to_ascii($domain, $flags, $variant, $idna_info); }
}
if (!function_exists('idn_to_utf8')) {
function idn_to_utf8($domain, $flags = 0, $variant = \INTL_IDNA_VARIANT_2003, &$idna_info = null) { return p\Idn::idn_to_utf8($domain, $flags, $variant, $idna_info); }
}
} else {
if (!function_exists('idn_to_ascii')) {
function idn_to_ascii($domain, $flags = 0, $variant = \INTL_IDNA_VARIANT_UTS46, &$idna_info = null) { return p\Idn::idn_to_ascii($domain, $flags, $variant, $idna_info); }
}
if (!function_exists('idn_to_utf8')) {
function idn_to_utf8($domain, $flags = 0, $variant = \INTL_IDNA_VARIANT_UTS46, &$idna_info = null) { return p\Idn::idn_to_utf8($domain, $flags, $variant, $idna_info); }
}
}

View File

@ -0,0 +1,125 @@
<?php
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
use Symfony\Polyfill\Intl\Idn as p;
if (!defined('U_IDNA_PROHIBITED_ERROR')) {
define('U_IDNA_PROHIBITED_ERROR', 66560);
}
if (!defined('U_IDNA_ERROR_START')) {
define('U_IDNA_ERROR_START', 66560);
}
if (!defined('U_IDNA_UNASSIGNED_ERROR')) {
define('U_IDNA_UNASSIGNED_ERROR', 66561);
}
if (!defined('U_IDNA_CHECK_BIDI_ERROR')) {
define('U_IDNA_CHECK_BIDI_ERROR', 66562);
}
if (!defined('U_IDNA_STD3_ASCII_RULES_ERROR')) {
define('U_IDNA_STD3_ASCII_RULES_ERROR', 66563);
}
if (!defined('U_IDNA_ACE_PREFIX_ERROR')) {
define('U_IDNA_ACE_PREFIX_ERROR', 66564);
}
if (!defined('U_IDNA_VERIFICATION_ERROR')) {
define('U_IDNA_VERIFICATION_ERROR', 66565);
}
if (!defined('U_IDNA_LABEL_TOO_LONG_ERROR')) {
define('U_IDNA_LABEL_TOO_LONG_ERROR', 66566);
}
if (!defined('U_IDNA_ZERO_LENGTH_LABEL_ERROR')) {
define('U_IDNA_ZERO_LENGTH_LABEL_ERROR', 66567);
}
if (!defined('U_IDNA_DOMAIN_NAME_TOO_LONG_ERROR')) {
define('U_IDNA_DOMAIN_NAME_TOO_LONG_ERROR', 66568);
}
if (!defined('U_IDNA_ERROR_LIMIT')) {
define('U_IDNA_ERROR_LIMIT', 66569);
}
if (!defined('U_STRINGPREP_PROHIBITED_ERROR')) {
define('U_STRINGPREP_PROHIBITED_ERROR', 66560);
}
if (!defined('U_STRINGPREP_UNASSIGNED_ERROR')) {
define('U_STRINGPREP_UNASSIGNED_ERROR', 66561);
}
if (!defined('U_STRINGPREP_CHECK_BIDI_ERROR')) {
define('U_STRINGPREP_CHECK_BIDI_ERROR', 66562);
}
if (!defined('IDNA_DEFAULT')) {
define('IDNA_DEFAULT', 0);
}
if (!defined('IDNA_ALLOW_UNASSIGNED')) {
define('IDNA_ALLOW_UNASSIGNED', 1);
}
if (!defined('IDNA_USE_STD3_RULES')) {
define('IDNA_USE_STD3_RULES', 2);
}
if (!defined('IDNA_CHECK_BIDI')) {
define('IDNA_CHECK_BIDI', 4);
}
if (!defined('IDNA_CHECK_CONTEXTJ')) {
define('IDNA_CHECK_CONTEXTJ', 8);
}
if (!defined('IDNA_NONTRANSITIONAL_TO_ASCII')) {
define('IDNA_NONTRANSITIONAL_TO_ASCII', 16);
}
if (!defined('IDNA_NONTRANSITIONAL_TO_UNICODE')) {
define('IDNA_NONTRANSITIONAL_TO_UNICODE', 32);
}
if (!defined('INTL_IDNA_VARIANT_UTS46')) {
define('INTL_IDNA_VARIANT_UTS46', 1);
}
if (!defined('IDNA_ERROR_EMPTY_LABEL')) {
define('IDNA_ERROR_EMPTY_LABEL', 1);
}
if (!defined('IDNA_ERROR_LABEL_TOO_LONG')) {
define('IDNA_ERROR_LABEL_TOO_LONG', 2);
}
if (!defined('IDNA_ERROR_DOMAIN_NAME_TOO_LONG')) {
define('IDNA_ERROR_DOMAIN_NAME_TOO_LONG', 4);
}
if (!defined('IDNA_ERROR_LEADING_HYPHEN')) {
define('IDNA_ERROR_LEADING_HYPHEN', 8);
}
if (!defined('IDNA_ERROR_TRAILING_HYPHEN')) {
define('IDNA_ERROR_TRAILING_HYPHEN', 16);
}
if (!defined('IDNA_ERROR_HYPHEN_3_4')) {
define('IDNA_ERROR_HYPHEN_3_4', 32);
}
if (!defined('IDNA_ERROR_LEADING_COMBINING_MARK')) {
define('IDNA_ERROR_LEADING_COMBINING_MARK', 64);
}
if (!defined('IDNA_ERROR_DISALLOWED')) {
define('IDNA_ERROR_DISALLOWED', 128);
}
if (!defined('IDNA_ERROR_PUNYCODE')) {
define('IDNA_ERROR_PUNYCODE', 256);
}
if (!defined('IDNA_ERROR_LABEL_HAS_DOT')) {
define('IDNA_ERROR_LABEL_HAS_DOT', 512);
}
if (!defined('IDNA_ERROR_INVALID_ACE_LABEL')) {
define('IDNA_ERROR_INVALID_ACE_LABEL', 1024);
}
if (!defined('IDNA_ERROR_BIDI')) {
define('IDNA_ERROR_BIDI', 2048);
}
if (!defined('IDNA_ERROR_CONTEXTJ')) {
define('IDNA_ERROR_CONTEXTJ', 4096);
}
if (!function_exists('idn_to_ascii')) {
function idn_to_ascii(?string $domain, ?int $flags = IDNA_DEFAULT, ?int $variant = INTL_IDNA_VARIANT_UTS46, &$idna_info = null): string|false { return p\Idn::idn_to_ascii((string) $domain, (int) $flags, (int) $variant, $idna_info); }
}
if (!function_exists('idn_to_utf8')) {
function idn_to_utf8(?string $domain, ?int $flags = IDNA_DEFAULT, ?int $variant = INTL_IDNA_VARIANT_UTS46, &$idna_info = null): string|false { return p\Idn::idn_to_utf8((string) $domain, (int) $flags, (int) $variant, $idna_info); }
}

View File

@ -0,0 +1,41 @@
{
"name": "symfony/polyfill-intl-idn",
"type": "library",
"description": "Symfony polyfill for intl's idn_to_ascii and idn_to_utf8 functions",
"keywords": ["polyfill", "shim", "compatibility", "portable", "intl", "idn"],
"homepage": "https://symfony.com",
"license": "MIT",
"authors": [
{
"name": "Laurent Bassin",
"email": "laurent@bassin.info"
},
{
"name": "Trevor Rowbotham",
"email": "trevor.rowbotham@pm.me"
},
{
"name": "Symfony Community",
"homepage": "https://symfony.com/contributors"
}
],
"require": {
"php": ">=7.1",
"symfony/polyfill-intl-normalizer": "^1.10",
"symfony/polyfill-php72": "^1.10"
},
"autoload": {
"psr-4": { "Symfony\\Polyfill\\Intl\\Idn\\": "" },
"files": [ "bootstrap.php" ]
},
"suggest": {
"ext-intl": "For best performance"
},
"minimum-stability": "dev",
"extra": {
"thanks": {
"name": "symfony/polyfill",
"url": "https://github.com/symfony/polyfill"
}
}
}