1--TEST--
2Test mb_strstr() function : variation - case sensitivity
3--EXTENSIONS--
4mbstring
5--FILE--
6<?php
7echo "*** Testing mb_strstr() : variation ***\n";
8
9mb_internal_encoding('UTF-8');
10
11//ascii
12$string_ascii = 'abcdef';
13$needle_ascii_upper = "BCD";
14$needle_ascii_mixed = "bCd";
15$needle_ascii_lower = "bcd";
16
17//Greek string in lower case UTF-8
18$string_mb = base64_decode('zrHOss6zzrTOtc62zrfOuM65zrrOu868zr3Ovs6/z4DPgc+Dz4TPhc+Gz4fPiM+J');
19$needle_mb_upper = base64_decode('zpzOnc6ezp8=');
20$needle_mb_lower = base64_decode('zrzOvc6+zr8=');
21$needle_mb_mixed = base64_decode('zpzOnc6+zr8=');
22
23echo "-- Ascii data --\n";
24// needle should be found
25var_dump(bin2hex(mb_strstr($string_ascii, $needle_ascii_lower)));
26// no needle should be found
27var_dump(mb_strstr($string_ascii, $needle_ascii_upper));
28var_dump(mb_strstr($string_ascii, $needle_ascii_mixed));
29
30echo "-- mb data in utf-8 --\n";
31// needle should be found
32$res = mb_strstr($string_mb, $needle_mb_lower, false);
33if ($res !== false) {
34    var_dump(bin2hex($res));
35}
36else {
37   echo "nothing found!\n";
38}
39// no needle should be found
40var_dump(mb_strstr($string_mb, $needle_mb_upper));
41var_dump(mb_strstr($string_mb, $needle_mb_mixed));
42
43
44?>
45--EXPECT--
46*** Testing mb_strstr() : variation ***
47-- Ascii data --
48string(10) "6263646566"
49bool(false)
50bool(false)
51-- mb data in utf-8 --
52string(52) "cebccebdcebecebfcf80cf81cf83cf84cf85cf86cf87cf88cf89"
53bool(false)
54bool(false)
55