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