Skip to content

Commit

Permalink
YAML handler bug-fix.
Browse files Browse the repository at this point in the history
  • Loading branch information
Maikuolan committed Nov 22, 2023
1 parent 09d0b06 commit 525c041
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/YAML.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php
/**
* YAML handler (last modified: 2023.11.21).
* YAML handler (last modified: 2023.11.22).
*
* This file is a part of the "common classes package", utilised by a number of
* packages and projects, including CIDRAM and phpMussel.
Expand Down Expand Up @@ -876,7 +876,7 @@ private function unescape(string $Value = '', string $Style = '"'): string
'~(?<!\\\\)\\\\((?:\\\\{2})*)_~',
'~(?<!\\\\)\\\\((?:\\\\{2})*)L~',
'~(?<!\\\\)\\\\((?:\\\\{2})*)P~'
], ['#', "\0", "\7", "\x08", "\t", "\n", "\x0B", "\x0C", "\x0D", "\x1B", '"', '/', "\xC2\x85", "\xC2\xA0", "\xE2\x80\xA8", "\xE2\x80\xA9"], $Value);
], ['\1#', "\\1\0", "\\1\7", "\\1\x08", "\\1\t", "\\1\n", "\\1\x0B", "\\1\x0C", "\\1\x0D", "\\1\x1B", '\1"', '\1/', "\\1\xC2\x85", "\\1\xC2\xA0", "\\1\xE2\x80\xA8", "\\1\xE2\x80\xA9"], $Value);
$Value = preg_replace_callback('~(?<!\\\\)\\\\((?:\\\\{2})*)x([\dA-Fa-f]{2})~', function ($Captured) {
return ($Decoded = hex2bin($Captured[2])) === false ? $Captured[0] : $Captured[1] . $Decoded;
}, $Value);
Expand Down

0 comments on commit 525c041

Please sign in to comment.