1--TEST-- 2mb_str_split() error conditions 3--EXTENSIONS-- 4mbstring 5--FILE-- 6<?php 7 8$string = "日本"; /* 2 chars */ 9 10// Invalid split length 11try { 12 mb_str_split($string, 0); 13} catch (\ValueError $e) { 14 echo $e->getMessage() . \PHP_EOL; 15} 16try { 17 mb_str_split($string, -5); 18} catch (\ValueError $e) { 19 echo $e->getMessage() . \PHP_EOL; 20} 21 22//Invalid Encoding 23try { 24 mb_str_split($string, 1, "BAD_ENCODING"); 25} catch (\ValueError $e) { 26 echo $e->getMessage() . \PHP_EOL; 27} 28 29?> 30--EXPECT-- 31mb_str_split(): Argument #2 ($length) must be greater than 0 32mb_str_split(): Argument #2 ($length) must be greater than 0 33mb_str_split(): Argument #3 ($encoding) must be a valid encoding, "BAD_ENCODING" given 34