1
0
mirror of https://github.com/php/php-src.git synced 2026-03-24 00:02:20 +01:00

Merge branch 'PHP-8.2'

* PHP-8.2:
  Fix mb_strlen is wrong length for CP932 when 0x80.
This commit is contained in:
Alex Dowad
2023-05-30 13:47:33 -07:00
2 changed files with 14 additions and 2 deletions

View File

@@ -8050,7 +8050,7 @@ const mbfl_encoding mbfl_encoding_sjis2004 = {
* 0x7E will go to 0x7E when converting Shift-JIS to CP932.
*/
static const unsigned char mblen_table_sjiswin[] = { /* 0x80-0x9F,0xE0-0xFF */
static const unsigned char mblen_table_sjiswin[] = { /* 0x81-0x9F,0xE0-0xFF */
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
@@ -8059,7 +8059,7 @@ static const unsigned char mblen_table_sjiswin[] = { /* 0x80-0x9F,0xE0-0xFF */
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,

View File

@@ -35,6 +35,13 @@ print "-- Testing illegal bytes 0x80,0xFD-FF --\n";
print mb_strlen("\x80\xA1", 'SJIS') . "\n";
print mb_strlen("abc\xFD\xFE\xFF", 'SJIS') . "\n";
echo "== CP932 ==\n";
print mb_strlen("\x80\xA1", "CP932") . "\n";
// 0xFD, 0xFE, 0xFF is reserved.
print mb_strlen("abc\xFD\xFE\xFF", 'CP932') . "\n";
print mb_strlen("\x80\xA1", "SJIS-win") . "\n";
print mb_strlen("abc\xFD\xFE\xFF", 'SJIS-win') . "\n";
echo "== MacJapanese ==\n";
print mb_strlen("\x80\xA1", 'MacJapanese') . "\n";
print mb_strlen("abc\xFD\xFE\xFF", 'MacJapanese') . "\n";
@@ -107,6 +114,11 @@ try {
-- Testing illegal bytes 0x80,0xFD-FF --
2
6
== CP932 ==
2
6
2
6
== MacJapanese ==
2
7