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