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