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