1--TEST--
2Test mb_strlen() function : error conditions - pass an unknown encoding
3--SKIPIF--
4<?php
5extension_loaded('mbstring') or die('skip');
6function_exists('mb_strlen') or die("skip mb_strlen() is not available in this build");
7?>
8--FILE--
9<?php
10/*
11 * Test mb_strlen when passed an unknown encoding
12 */
13
14echo "*** Testing mb_strlen() : error ***\n";
15
16$string = 'abcdef';
17
18$encoding = 'unknown-encoding';
19
20try {
21    var_dump(mb_strlen($string, $encoding));
22} catch (\ValueError $e) {
23    echo $e->getMessage() . \PHP_EOL;
24}
25
26?>
27--EXPECT--
28*** Testing mb_strlen() : error ***
29mb_strlen(): Argument #2 ($encoding) must be a valid encoding, "unknown-encoding" given
30