1--TEST--
2Test mb_stristr() function : error conditions
3--EXTENSIONS--
4mbstring
5--FILE--
6<?php
7echo "*** Testing mb_stristr() : error conditions ***\n";
8
9
10echo "\n-- Testing mb_stristr() with unknown encoding --\n";
11$haystack = 'Hello, world';
12$needle = 'world';
13$encoding = 'unknown-encoding';
14$part = true;
15
16try {
17    var_dump( mb_stristr($haystack, $needle, $part, $encoding) );
18} catch (\ValueError $e) {
19    echo $e->getMessage() . \PHP_EOL;
20}
21
22?>
23--EXPECT--
24*** Testing mb_stristr() : error conditions ***
25
26-- Testing mb_stristr() with unknown encoding --
27mb_stristr(): Argument #4 ($encoding) must be a valid encoding, "unknown-encoding" given
28