1--TEST--
2Test iconv_substr() function : error conditions - Pass an unknown encoding
3--SKIPIF--
4<?php
5extension_loaded('iconv') or die('skip');
6function_exists('iconv_substr') or die("skip iconv_substr() is not available in this build");
7?>
8--FILE--
9<?php
10/*
11 * Pass an unknown encoding to iconv_substr() to test behaviour
12 */
13
14echo "*** Testing iconv_substr() : error conditions ***\n";
15
16$str = 'Hello, world';
17$start = 1;
18$length = 5;
19$encoding = 'unknown-encoding';
20
21var_dump( iconv_substr($str, $start, $length, $encoding));
22
23echo "Done";
24?>
25--EXPECTF--
26*** Testing iconv_substr() : error conditions ***
27
28Warning: iconv_substr(): Wrong encoding, conversion from "unknown-encoding" to "UCS-4LE" is not allowed in %s on line %d
29bool(false)
30Done
31