1--TEST--
2Test mb_strtoupper() function : usage varitations - pass mixed ASCII and non-ASCII strings
3--SKIPIF--
4<?php
5extension_loaded('mbstring') or die('skip');
6function_exists('mb_strtoupper') or die("skip mb_strtoupper() is not available in this build");
7?>
8--FILE--
9<?php
10/*
11 * Pass a Japanese string and a mixed Japanese and ASCII string to mb_strtolower
12 * to check correct conversion is occurring (Japanese characters should not be converted).
13 */
14
15echo "*** Testing mb_strtoupper() : usage variations ***\n";
16
17$string_mixed_upper = base64_decode('5pel5pys6Kqe44OG44Kt44K544OI44Gn44GZ44CCUEhQLiAwMTIzNO+8le+8lu+8l++8mO+8meOAgg==');
18$string_mixed_lower = base64_decode('5pel5pys6Kqe44OG44Kt44K544OI44Gn44GZ44CCcGhwLiAwMTIzNO+8le+8lu+8l++8mO+8meOAgg==');
19$string_all_mb = base64_decode('5pel5pys6Kqe44OG44Kt44K544OI44Gn44GZ44CC');
20
21
22echo "\n-- Mixed string (mulitbyte and ASCII characters) --\n";
23$a = mb_strtoupper($string_mixed_lower, 'UTF-8');
24var_dump(base64_encode($a));
25if ($a == $string_mixed_upper) {
26    echo "Correctly Converted\n";
27} else {
28    echo "Incorrectly Converted\n";
29}
30
31echo "\n-- Multibyte Only String--\n";
32$b = mb_strtoupper($string_all_mb, 'UTF-8');
33var_dump(base64_encode($b));
34if ($b == $string_all_mb) { // Japanese characters only - should not be any conversion
35    echo "Correctly Converted\n";
36} else {
37    echo "Incorrectly Converted\n";
38}
39
40echo "Done";
41?>
42--EXPECT--
43*** Testing mb_strtoupper() : usage variations ***
44
45-- Mixed string (mulitbyte and ASCII characters) --
46string(80) "5pel5pys6Kqe44OG44Kt44K544OI44Gn44GZ44CCUEhQLiAwMTIzNO+8le+8lu+8l++8mO+8meOAgg=="
47Correctly Converted
48
49-- Multibyte Only String--
50string(40) "5pel5pys6Kqe44OG44Kt44K544OI44Gn44GZ44CC"
51Correctly Converted
52Done
53