Skip to content

Commit

Permalink
Code-style patch.
Browse files Browse the repository at this point in the history
  • Loading branch information
Maikuolan committed Nov 21, 2023
1 parent eb68a3d commit 513f65e
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/YAML.php
Original file line number Diff line number Diff line change
Expand Up @@ -877,17 +877,17 @@ private function unescape(string $Value = '', string $Style = '"'): string
'~(?<!\\\\)\\\\((?:\\\\{2})*)L~',
'~(?<!\\\\)\\\\((?:\\\\{2})*)P~'
], ['#', "\0", "\7", "\x08", "\t", "\n", "\x0B", "\x0C", "\x0D", "\x1B", '"', '/', "\xC2\x85", "\xC2\xA0", "\xE2\x80\xA8", "\xE2\x80\xA9"], $Value);
$Value = preg_replace_callback('~(?<!\\\\)\\\\((?:\\\\{2})*)x([\dA-Fa-f]{2})~', function($Captured) {
$Value = preg_replace_callback('~(?<!\\\\)\\\\((?:\\\\{2})*)x([\dA-Fa-f]{2})~', function ($Captured) {
return ($Decoded = hex2bin($Captured[2])) === false ? $Captured[0] : $Captured[1] . $Decoded;
}, $Value);
$Value = preg_replace_callback('~(?<!\\\\)\\\\((?:\\\\{2})*)u([\dA-Fa-f]{4})~', function($Captured) {
$Value = preg_replace_callback('~(?<!\\\\)\\\\((?:\\\\{2})*)u([\dA-Fa-f]{4})~', function ($Captured) {
if (($Decoded = hex2bin($Captured[2])) === false) {
return $Captured[0];
}
$Reversed = ($Attempt = iconv('UTF-16BE', 'UTF-8', $Decoded)) === false ? '' : iconv('UTF-8', 'UTF-16BE', $Attempt);
return $Captured[1] . (($Attempt !== false && strcmp($Reversed, $Decoded) === 0) ? $Attempt : $Decoded);
}, $Value);
$Value = preg_replace_callback('~(?<!\\\\)\\\\((?:\\\\{2})*)U([\dA-Fa-f]{8})~', function($Captured) {
$Value = preg_replace_callback('~(?<!\\\\)\\\\((?:\\\\{2})*)U([\dA-Fa-f]{8})~', function ($Captured) {
if (($Decoded = hex2bin($Captured[2])) === false) {
return $Captured[0];
}
Expand Down

0 comments on commit 513f65e

Please sign in to comment.