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