1--TEST-- 2Test iconv_strpos() function : error conditions - Pass unknown encoding 3--SKIPIF-- 4<?php 5extension_loaded('iconv') or die('skip'); 6function_exists('iconv_strpos') or die("skip iconv_strpos() is not available in this build"); 7?> 8--FILE-- 9<?php 10/* Prototype : int iconv_strpos(string haystack, string needle [, int offset [, string charset]]) 11 * Description: Find position of first occurrence of a string within another 12 * Source code: ext/iconv/iconv.c 13 */ 14 15/* 16 * Pass an unknown encoding to iconv_strpos() to test behaviour 17 */ 18 19echo "*** Testing iconv_strpos() : error conditions ***\n"; 20$haystack = 'Hello, world'; 21$needle = 'world'; 22$offset = 2; 23$encoding = 'unknown-encoding'; 24 25var_dump( iconv_strpos($haystack, $needle, $offset, $encoding) ); 26 27echo "Done"; 28?> 29--EXPECTF-- 30*** Testing iconv_strpos() : error conditions *** 31 32Notice: iconv_strpos(): Wrong charset, conversion from `unknown-encoding' to `UCS-4LE' is not allowed in %s on line %d 33bool(false) 34Done 35