Skip to content

Commit 1e02099

Browse files
authored
ext/mbstring: Use internal_encoding INI setting instead of mb_internal_encoding() in tests (php#19663)
Moves the usage of `mb_internal_encoding()` to INI section for the tests not testing the encoding/function itself, but the other mbstring/iconv functions.
1 parent a4afc57 commit 1e02099

File tree

72 files changed

+122
-119
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

72 files changed

+122
-119
lines changed

ext/mbstring/tests/bug54494.phpt

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,11 @@
22
Bug #54494: mb_substr() mishandles UTF-32LE and UCS-2LE
33
--EXTENSIONS--
44
mbstring
5+
--INI--
6+
internal_encoding=UTF-8
57
--FILE--
68
<?php
79

8-
//declare(encoding = 'UTF-8');
9-
mb_internal_encoding('UTF-8');
10-
1110
header('Content-Type: text/plain; charset=UTF-32LE');
1211

1312
$stringOr = "hällö wörld\n";

ext/mbstring/tests/bug65045.phpt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,11 @@
22
Bug #65045: mb_convert_encoding breaks well-formed character
33
--EXTENSIONS--
44
mbstring
5+
--INI--
6+
internal_encoding=UTF-8
57
--FILE--
68
<?php
79

8-
mb_internal_encoding('UTF-8');
9-
1010
$str = "\xF0\xA4\xAD". "\xF0\xA4\xAD\xA2"."\xF0\xA4\xAD\xA2";
1111
$str2 = "\xF0\xA4\xAD\xA2"."\xF0\xA4\xAD\xA2"."\xF0\xA4\xAD";
1212

ext/mbstring/tests/bug79441.phpt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,11 @@
22
Bug #79441 Segfault in mb_chr() if internal encoding is unsupported
33
--EXTENSIONS--
44
mbstring
5+
--INI--
6+
internal_encoding=utf-7
57
--FILE--
68
<?php
79

8-
mb_internal_encoding("utf-7");
910
try {
1011
mb_chr(0xd800);
1112
} catch (\ValueError $e) {

ext/mbstring/tests/gh7902.phpt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,9 @@ if (str_contains(getcwd(), " ")) die("skip sendmail_path ini with spaces");
88
?>
99
--INI--
1010
sendmail_path={MAIL:{PWD}/gh7902.eml}
11+
internal_encoding=UTF-8
1112
--FILE--
1213
<?php
13-
mb_internal_encoding("UTF-8");
1414
mb_language("uni");
1515
1616
$subject = "test mail";

ext/mbstring/tests/gh8086.phpt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,11 @@ GH-8086 (mb_send_mail() function not working correctly in PHP 8.x)
33
--EXTENSIONS--
44
mbstring
55
--INI--
6+
internal_encoding=UTF-8
67
sendmail_path={MAIL:{PWD}/gh8086.eml}
78
mail.mixed_lf_and_crlf=on
89
--FILE--
910
<?php
10-
mb_internal_encoding("UTF-8");
1111
mb_language("uni");
1212
1313
$subject = "test mail";

ext/mbstring/tests/mb_decode_mimeheader_basic.phpt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,11 @@
22
Test mb_decode_mimeheader() function : basic functionality
33
--EXTENSIONS--
44
mbstring
5+
--INI--
6+
internal_encoding=utf-8
57
--FILE--
68
<?php
79
echo "*** Testing mb_decode_mimeheader() : basic functionality ***\n";
8-
mb_internal_encoding('utf-8');
910

1011
//the following encoded-words are identical and are UTF-8 Japanese.
1112
$a = "=?UTF-8?b?5pel5pys6Kqe44OG44Kt44K544OI44Gn44GZ44CC?=";

ext/mbstring/tests/mb_decode_mimeheader_variation2.phpt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,11 @@
22
Test mb_decode_mimeheader() function : variation
33
--EXTENSIONS--
44
mbstring
5+
--INI--
6+
internal_encoding=utf-8
57
--FILE--
68
<?php
79
echo "*** Testing mb_decode_mimeheader() : variation ***\n";
8-
mb_internal_encoding('utf-8');
910

1011
//all the following are identical, we will convert to utf-8
1112

ext/mbstring/tests/mb_decode_mimeheader_variation3.phpt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,11 @@
22
Test mb_decode_mimeheader() function : variation
33
--EXTENSIONS--
44
mbstring
5+
--INI--
6+
internal_encoding=iso-8859-7
57
--FILE--
68
<?php
79
echo "*** Testing mb_decode_mimeheader() : variation ***\n";
8-
mb_internal_encoding('iso-8859-7');
910

1011
//greek in UTF-8 to be converted to iso-8859-7
1112
$encoded_word = "=?UTF-8?B?zrHOss6zzrTOtc62zrfOuM65zrrOu868zr3Ovs6/z4DPgc+Dz4TPhc+Gz4fPiM+J?=";

ext/mbstring/tests/mb_encode_mimeheader_indent.phpt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22
Test mb_encode_mimeheader() function : basic functionality, indent
33
--EXTENSIONS--
44
mbstring
5+
--INI--
6+
internal_encoding=utf-8
57
--FILE--
68
<?php
79
/* (string $str [, string $charset [, string $transfer_encoding [, string $linefeed [, int $indent]]]])
@@ -15,8 +17,6 @@ mbstring
1517

1618
echo "*** Testing mb_encode_mimeheader() : indent ***\n";
1719

18-
mb_internal_encoding('utf-8');
19-
2020
// Initialise function arguments not being substituted
2121
$str = base64_decode('zpHPhc+Ez4wgzrXOr869zrHOuSDOtc67zrvOt869zrnOus+MIM66zrXOr868zrXOvc6/LiAwMTIzNDU2Nzg5Lg==');
2222
$charset = 'utf-8';

ext/mbstring/tests/mb_encode_mimeheader_variation6.phpt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22
Test mb_encode_mimeheader() function : usage variations - Pass different strings to $linefeed arg
33
--EXTENSIONS--
44
mbstring
5+
--INI--
6+
internal_encoding=utf-8
57
--FILE--
68
<?php
79
/* (string $str [, string $charset [, string $transfer_encoding [, string $linefeed [, int $indent]]]])
@@ -15,8 +17,6 @@ mbstring
1517

1618
echo "*** Testing mb_encode_mimeheader() : usage variations ***\n";
1719

18-
mb_internal_encoding('utf-8');
19-
2020
$linefeeds = array("\r\n",
2121
"\n",
2222
"---");

0 commit comments

Comments
 (0)