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