Commit c211e67
committed
Remove XFAIL from test cases for mb_strcut when used with JIS or ISO-2022-JP encoding
The documentation for mb_strcut states:
mb_strcut(
string $string,
int $start,
?int $length = null,
?string $encoding = null
): string
mb_strcut() extracts a substring from a string similarly to mb_substr(),
but operates on bytes instead of characters. If the cut position happens
to be between two bytes of a multi-byte character, the cut is performed
starting from the first byte of that character.
My understanding of the $length parameter for mb_strcut is that it
specified the range of bytes to extract from $string, and that all
characters encoded by those bytes should be included in the returned
string, even if that means the returned string would be longer than
$length bytes. This can happen either if 1) there is more than one way
to encode the same character in $encoding, and one way requires more
bytes than the other, or 2) $encoding uses escape sequences.
However, discussion with users of mb_strcut indicates that many of them
interpret $length as the maximum length of the *returned* string.
This is also the historical behavior of the function.
Hence, there is no need to modify the behavior of mb_strcut and then
remove XFAIL from these test cases afterwards. We can keep the current
behavior.1 parent 3ab6e76 commit c211e67
1 file changed
+4
-13
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | | - | |
| 2 | + | |
3 | 3 | | |
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
7 | | - | |
8 | | - | |
9 | | - | |
10 | | - | |
11 | | - | |
12 | | - | |
13 | | - | |
14 | 7 | | |
15 | 8 | | |
16 | 9 | | |
| |||
78 | 71 | | |
79 | 72 | | |
80 | 73 | | |
81 | | - | |
82 | | - | |
83 | 74 | | |
84 | | - | |
85 | | - | |
| 75 | + | |
| 76 | + | |
86 | 77 | | |
87 | 78 | | |
88 | 79 | | |
89 | 80 | | |
90 | | - | |
| 81 | + | |
91 | 82 | | |
92 | 83 | | |
93 | 84 | | |
| |||
0 commit comments