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