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