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/* Prototype : string iconv_substr(string str, int offset, [int length, string charset]) 11 * Description: Returns part of a string 12 * Source code: ext/iconv/iconv.c 13 */ 14 15/* 16 * Pass an unknown encoding to iconv_substr() to test behaviour 17 */ 18 19echo "*** Testing iconv_substr() : error conditions ***\n"; 20 21$str = 'Hello, world'; 22$start = 1; 23$length = 5; 24$encoding = 'unknown-encoding'; 25 26var_dump( iconv_substr($str, $start, $length, $encoding)); 27 28echo "Done"; 29?> 30--EXPECTF-- 31*** Testing iconv_substr() : error conditions *** 32 33Notice: iconv_substr(): Wrong charset, conversion from `unknown-encoding' to `UCS-4LE' is not allowed in %s on line %d 34bool(false) 35Done 36 37