You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Promote invalid case mode to ValueError in mb_case_converter
Add assertions to check the return value is not NULL as this indicates a bug.
Add identical assertion to mb_strtoupper and mb_strtolower.
This means these functions can't return false anymore, ammend stubs accordingly.
Calling mb_convert_case() with an invalid casing mode
3
+
--SKIPIF--
4
+
<?phprequire'skipif.inc'; ?>
5
+
--FILE--
6
+
<?php
7
+
8
+
var_dump(mb_convert_case('foo BAR Spaß', MB_CASE_UPPER));
9
+
var_dump(mb_convert_case('foo BAR Spaß', MB_CASE_LOWER));
10
+
var_dump(mb_convert_case('foo BAR Spaß', MB_CASE_TITLE));
11
+
var_dump(mb_convert_case('foo BAR Spaß', MB_CASE_FOLD));
12
+
var_dump(mb_convert_case('foo BAR Spaß', MB_CASE_UPPER_SIMPLE));
13
+
var_dump(mb_convert_case('foo BAR Spaß', MB_CASE_LOWER_SIMPLE));
14
+
var_dump(mb_convert_case('foo BAR Spaß', MB_CASE_TITLE_SIMPLE));
15
+
var_dump(mb_convert_case('foo BAR Spaß', MB_CASE_FOLD_SIMPLE));
16
+
17
+
// Invalid mode
18
+
try {
19
+
var_dump(mb_convert_case('foo BAR Spaß', 100));
20
+
} catch (\ValueError$e) {
21
+
echo$e->getMessage() . \PHP_EOL;
22
+
}
23
+
24
+
?>
25
+
--EXPECT--
26
+
string(13) "FOO BAR SPASS"
27
+
string(13) "foo bar spaß"
28
+
string(13) "Foo Bar Spaß"
29
+
string(13) "foo bar spass"
30
+
string(13) "FOO BAR SPAß"
31
+
string(13) "foo bar spaß"
32
+
string(13) "Foo Bar Spaß"
33
+
string(13) "foo bar spaß"
34
+
mb_convert_case(): Argument #2 ($mode) must be one of MB_CASE_UPPER, MB_CASE_LOWER, MB_CASE_TITLE, MB_CASE_FOLD, MB_CASE_UPPER_SIMPLE, MB_CASE_LOWER_SIMPLE, MB_CASE_TITLE_SIMPLE, or MB_CASE_FOLD_SIMPLE
0 commit comments