1--TEST-- 2Test mb_strtolower() function : Two error messages returned for incorrect encoding for mb_strto[upper|lower] 3--SKIPIF-- 4<?php 5extension_loaded('mbstring') or die('skip'); 6function_exists('mb_strtolower') or die("skip mb_strtolower() is not available in this build"); 7?> 8--FILE-- 9<?php 10/* 11 * Two error messages returned for incorrect encoding for mb_strto[upper|lower] 12 * Bug now appears to be fixed 13 */ 14 15$sourcestring = 'Hello, World'; 16 17$inputs = array(12345, 12.3456789000E-10, true, false, ""); 18$iterator = 1; 19foreach($inputs as $input) { 20 echo "\n-- Iteration $iterator --\n"; 21 try { 22 var_dump( mb_strtolower($sourcestring, $input) ); 23 } catch (\ValueError $e) { 24 echo $e->getMessage() . \PHP_EOL; 25 } 26 try { 27 var_dump( mb_strtoupper($sourcestring, $input) ); 28 } catch (\ValueError $e) { 29 echo $e->getMessage() . \PHP_EOL; 30 } 31 $iterator++; 32} 33 34?> 35--EXPECT-- 36-- Iteration 1 -- 37mb_strtolower(): Argument #2 ($encoding) must be a valid encoding, "12345" given 38mb_strtoupper(): Argument #2 ($encoding) must be a valid encoding, "12345" given 39 40-- Iteration 2 -- 41mb_strtolower(): Argument #2 ($encoding) must be a valid encoding, "1.23456789E-9" given 42mb_strtoupper(): Argument #2 ($encoding) must be a valid encoding, "1.23456789E-9" given 43 44-- Iteration 3 -- 45mb_strtolower(): Argument #2 ($encoding) must be a valid encoding, "1" given 46mb_strtoupper(): Argument #2 ($encoding) must be a valid encoding, "1" given 47 48-- Iteration 4 -- 49mb_strtolower(): Argument #2 ($encoding) must be a valid encoding, "" given 50mb_strtoupper(): Argument #2 ($encoding) must be a valid encoding, "" given 51 52-- Iteration 5 -- 53mb_strtolower(): Argument #2 ($encoding) must be a valid encoding, "" given 54mb_strtoupper(): Argument #2 ($encoding) must be a valid encoding, "" given 55