Update Composer packages
This commit is contained in:
parent
a80f1abaa4
commit
0a904482ae
41 changed files with 922 additions and 679 deletions
82
kirby/vendor/symfony/yaml/Unescaper.php
vendored
82
kirby/vendor/symfony/yaml/Unescaper.php
vendored
|
@ -45,9 +45,7 @@ class Unescaper
|
|||
*/
|
||||
public function unescapeDoubleQuotedString(string $value): string
|
||||
{
|
||||
$callback = function ($match) {
|
||||
return $this->unescapeCharacter($match[0]);
|
||||
};
|
||||
$callback = fn ($match) => $this->unescapeCharacter($match[0]);
|
||||
|
||||
// evaluate the string
|
||||
return preg_replace_callback('/'.self::REGEX_ESCAPED_CHARACTER.'/u', $callback, $value);
|
||||
|
@ -60,56 +58,34 @@ class Unescaper
|
|||
*/
|
||||
private function unescapeCharacter(string $value): string
|
||||
{
|
||||
switch ($value[1]) {
|
||||
case '0':
|
||||
return "\x0";
|
||||
case 'a':
|
||||
return "\x7";
|
||||
case 'b':
|
||||
return "\x8";
|
||||
case 't':
|
||||
return "\t";
|
||||
case "\t":
|
||||
return "\t";
|
||||
case 'n':
|
||||
return "\n";
|
||||
case 'v':
|
||||
return "\xB";
|
||||
case 'f':
|
||||
return "\xC";
|
||||
case 'r':
|
||||
return "\r";
|
||||
case 'e':
|
||||
return "\x1B";
|
||||
case ' ':
|
||||
return ' ';
|
||||
case '"':
|
||||
return '"';
|
||||
case '/':
|
||||
return '/';
|
||||
case '\\':
|
||||
return '\\';
|
||||
case 'N':
|
||||
// U+0085 NEXT LINE
|
||||
return "\xC2\x85";
|
||||
case '_':
|
||||
// U+00A0 NO-BREAK SPACE
|
||||
return "\xC2\xA0";
|
||||
case 'L':
|
||||
// U+2028 LINE SEPARATOR
|
||||
return "\xE2\x80\xA8";
|
||||
case 'P':
|
||||
// U+2029 PARAGRAPH SEPARATOR
|
||||
return "\xE2\x80\xA9";
|
||||
case 'x':
|
||||
return self::utf8chr(hexdec(substr($value, 2, 2)));
|
||||
case 'u':
|
||||
return self::utf8chr(hexdec(substr($value, 2, 4)));
|
||||
case 'U':
|
||||
return self::utf8chr(hexdec(substr($value, 2, 8)));
|
||||
default:
|
||||
throw new ParseException(sprintf('Found unknown escape character "%s".', $value));
|
||||
}
|
||||
return match ($value[1]) {
|
||||
'0' => "\x0",
|
||||
'a' => "\x7",
|
||||
'b' => "\x8",
|
||||
't' => "\t",
|
||||
"\t" => "\t",
|
||||
'n' => "\n",
|
||||
'v' => "\xB",
|
||||
'f' => "\xC",
|
||||
'r' => "\r",
|
||||
'e' => "\x1B",
|
||||
' ' => ' ',
|
||||
'"' => '"',
|
||||
'/' => '/',
|
||||
'\\' => '\\',
|
||||
// U+0085 NEXT LINE
|
||||
'N' => "\xC2\x85",
|
||||
// U+00A0 NO-BREAK SPACE
|
||||
'_' => "\xC2\xA0",
|
||||
// U+2028 LINE SEPARATOR
|
||||
'L' => "\xE2\x80\xA8",
|
||||
// U+2029 PARAGRAPH SEPARATOR
|
||||
'P' => "\xE2\x80\xA9",
|
||||
'x' => self::utf8chr(hexdec(substr($value, 2, 2))),
|
||||
'u' => self::utf8chr(hexdec(substr($value, 2, 4))),
|
||||
'U' => self::utf8chr(hexdec(substr($value, 2, 8))),
|
||||
default => throw new ParseException(sprintf('Found unknown escape character "%s".', $value)),
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue