Skip to content

Commit f6d9415

Browse files
committed
Ensure chr is 0-255
1 parent b191e40 commit f6d9415

4 files changed

Lines changed: 6 additions & 6 deletions

File tree

VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
2.0.42
1+
2.0.43

resources/debian/control

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,6 @@ Vcs-Git: https://github.com/~#VENDOR#~/~#PROJECT#~.git
1010
Package: ~#PKGNAME#~
1111
Provides: php-~#PROJECT#~
1212
Architecture: all
13-
Depends: php (>= 8.1.0), php-mbstring, php-tecnickcom-tc-lib-unicode-data (<< 3.0.0), php-tecnickcom-tc-lib-unicode-data (>= 2.0.41), ${misc:Depends}
13+
Depends: php (>= 8.1.0), php-mbstring, php-tecnickcom-tc-lib-unicode-data (<< 3.0.0), php-tecnickcom-tc-lib-unicode-data (>= 2.0.42), ${misc:Depends}
1414
Description: PHP Unicode methods.
1515
PHP library containing Unicode methods.

resources/rpm/rpm.spec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ BuildArch: noarch
1818

1919
Requires: php(language) >= 8.1.0
2020
Requires: php-composer(%{c_vendor}/tc-lib-unicode-data) < 3.0.0
21-
Requires: php-composer(%{c_vendor}/tc-lib-unicode-data) >= 2.0.41
21+
Requires: php-composer(%{c_vendor}/tc-lib-unicode-data) >= 2.0.42
2222
Requires: php-pcre
2323
Requires: php-mbstring
2424

src/Convert/Encoding.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,9 +43,9 @@ public function uniArrToLatinArr(array $ordarr): array
4343
$latarr = [];
4444
foreach ($ordarr as $chr) {
4545
if ($chr < 256) {
46-
$latarr[] = $chr;
46+
$latarr[] = $chr & 0xFF;
4747
} elseif (\array_key_exists($chr, Latin::SUBSTITUTE)) {
48-
$latarr[] = Latin::SUBSTITUTE[$chr];
48+
$latarr[] = Latin::SUBSTITUTE[$chr] & 0xFF;
4949
} elseif ($chr !== 0xFFFD) {
5050
$latarr[] = 63; // '?' character
5151
}
@@ -94,7 +94,7 @@ public function hexToStr(string $hex): string
9494
$str = '';
9595
$bytes = \str_split($hex, 2);
9696
foreach ($bytes as $byte) {
97-
$str .= \chr((int) \hexdec($byte));
97+
$str .= \chr(((int) \hexdec($byte)) & 0xFF);
9898
}
9999

100100
return $str;

0 commit comments

Comments
 (0)