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