Upgrade to 3.9.7

This commit is contained in:
Bastian Allgeier
2023-10-06 12:54:54 +02:00
parent 035d655ca1
commit 474ecd14c7
54 changed files with 714 additions and 329 deletions

View File

@@ -11,8 +11,6 @@
namespace Symfony\Polyfill\Intl\Idn;
use Exception;
use Normalizer;
use Symfony\Polyfill\Intl\Idn\Resources\unidata\DisallowedRanges;
use Symfony\Polyfill\Intl\Idn\Resources\unidata\Regex;
@@ -167,7 +165,7 @@ final class Idn
if (1 === preg_match('/[^\x00-\x7F]/', $label)) {
try {
$label = 'xn--'.self::punycodeEncode($label);
} catch (Exception $e) {
} catch (\Exception $e) {
$info->errors |= self::ERROR_PUNYCODE;
}
@@ -335,8 +333,8 @@ final class Idn
$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);
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.
@@ -350,7 +348,7 @@ final class Idn
if ('xn--' === substr($label, 0, 4)) {
try {
$label = self::punycodeDecode(substr($label, 4));
} catch (Exception $e) {
} catch (\Exception $e) {
$info->errors |= self::ERROR_PUNYCODE;
continue;
@@ -496,7 +494,7 @@ final class Idn
}
// Step 1. The label must be in Unicode Normalization Form C.
if (!Normalizer::isNormalized($label, Normalizer::FORM_C)) {
if (!\Normalizer::isNormalized($label, \Normalizer::FORM_C)) {
$info->errors |= self::ERROR_INVALID_ACE_LABEL;
}
@@ -583,7 +581,7 @@ final class Idn
for ($j = 0; $j < $b; ++$j) {
if ($bytes[$j] > 0x7F) {
throw new Exception('Invalid input');
throw new \Exception('Invalid input');
}
$output[$out++] = $input[$j];
@@ -599,17 +597,17 @@ final class Idn
for ($k = self::BASE; /* no condition */; $k += self::BASE) {
if ($in >= $inputLength) {
throw new Exception('Invalid input');
throw new \Exception('Invalid input');
}
$digit = self::$basicToDigit[$bytes[$in++] & 0xFF];
if ($digit < 0) {
throw new Exception('Invalid input');
throw new \Exception('Invalid input');
}
if ($digit > intdiv(self::MAX_INT - $i, $w)) {
throw new Exception('Integer overflow');
throw new \Exception('Integer overflow');
}
$i += $digit * $w;
@@ -629,7 +627,7 @@ final class Idn
$baseMinusT = self::BASE - $t;
if ($w > intdiv(self::MAX_INT, $baseMinusT)) {
throw new Exception('Integer overflow');
throw new \Exception('Integer overflow');
}
$w *= $baseMinusT;
@@ -639,7 +637,7 @@ final class Idn
$bias = self::adaptBias($i - $oldi, $outPlusOne, 0 === $oldi);
if (intdiv($i, $outPlusOne) > self::MAX_INT - $n) {
throw new Exception('Integer overflow');
throw new \Exception('Integer overflow');
}
$n += intdiv($i, $outPlusOne);
@@ -694,7 +692,7 @@ final class Idn
}
if ($m - $n > intdiv(self::MAX_INT - $delta, $h + 1)) {
throw new Exception('Integer overflow');
throw new \Exception('Integer overflow');
}
$delta += ($m - $n) * ($h + 1);
@@ -702,7 +700,7 @@ final class Idn
foreach ($iter as $codePoint) {
if ($codePoint < $n && 0 === ++$delta) {
throw new Exception('Integer overflow');
throw new \Exception('Integer overflow');
}
if ($codePoint === $n) {