1--TEST--
2Test mb_strstr() function : with empty needle
3--EXTENSIONS--
4mbstring
5--FILE--
6<?php
7
8mb_internal_encoding('UTF-8');
9
10$string_ascii = 'abc def';
11// Japanese string in UTF-8
12$string_mb = "日本語テキストです。0123456789。";
13
14echo "\n-- ASCII string --\n";
15var_dump(mb_strstr($string_ascii, '', false, 'ISO-8859-1'));
16var_dump(mb_strstr($string_ascii, ''));
17var_dump(mb_strstr($string_ascii, '', true));
18
19echo "\n-- Multibyte string --\n";
20var_dump(mb_strstr($string_mb, ''));
21var_dump(mb_strstr($string_mb, '', false, 'utf-8'));
22var_dump(mb_strstr($string_mb, '', true));
23
24?>
25--EXPECT--
26-- ASCII string --
27string(7) "abc def"
28string(7) "abc def"
29string(0) ""
30
31-- Multibyte string --
32string(53) "日本語テキストです。0123456789。"
33string(53) "日本語テキストです。0123456789。"
34string(0) ""
35