1--TEST-- 2Test convert_cyr_string() function : error conditions 3--FILE-- 4<?php 5 6/* Prototype : string convert_cyr_string ( string $str , string $from , string $to ) 7 * Description: Convert from one Cyrillic character set to another 8 * Source code: ext/standard/string.c 9*/ 10 11$str = "hello"; 12$from = "k"; 13$to = "d"; 14$extra_arg = 10; 15 16echo "*** Testing convert_cyr_string() : error conditions ***\n"; 17 18echo "\n-- Testing convert_cyr_string() function with no arguments --\n"; 19var_dump( convert_cyr_string() ); 20 21echo "\n-- Testing convert_cyr_string() function with no 'to' character set --\n"; 22var_dump( convert_cyr_string($str, $from) ); 23 24echo "\n-- Testing convert_cyr_string() function with more than expected no. of arguments --\n"; 25var_dump( convert_cyr_string($str, $from, $to, $extra_arg) ); 26 27echo "\n-- Testing convert_cyr_string() function with invalid 'from' character set --\n"; 28var_dump(bin2hex( convert_cyr_string($str, "?", $to) )); 29 30echo "\n-- Testing convert_cyr_string() function with invalid 'to' character set --\n"; 31var_dump(bin2hex( convert_cyr_string($str, $from, "?")) ); 32 33echo "\n-- Testing convert_cyr_string() function with invalid 'from' and 'to' character set --\n"; 34var_dump(bin2hex( convert_cyr_string($str, ">", "?")) ); 35 36?> 37===DONE=== 38--EXPECTF-- 39*** Testing convert_cyr_string() : error conditions *** 40 41-- Testing convert_cyr_string() function with no arguments -- 42 43Warning: convert_cyr_string() expects exactly 3 parameters, 0 given in %s on line %d 44NULL 45 46-- Testing convert_cyr_string() function with no 'to' character set -- 47 48Warning: convert_cyr_string() expects exactly 3 parameters, 2 given in %s on line %d 49NULL 50 51-- Testing convert_cyr_string() function with more than expected no. of arguments -- 52 53Warning: convert_cyr_string() expects exactly 3 parameters, 4 given in %s on line %d 54NULL 55 56-- Testing convert_cyr_string() function with invalid 'from' character set -- 57 58Warning: convert_cyr_string(): Unknown source charset: ? in %s on line %d 59string(10) "68656c6c6f" 60 61-- Testing convert_cyr_string() function with invalid 'to' character set -- 62 63Warning: convert_cyr_string(): Unknown destination charset: ? in %s on line %d 64string(10) "68656c6c6f" 65 66-- Testing convert_cyr_string() function with invalid 'from' and 'to' character set -- 67 68Warning: convert_cyr_string(): Unknown source charset: > in %s on line %d 69 70Warning: convert_cyr_string(): Unknown destination charset: ? in %s on line %d 71string(10) "68656c6c6f" 72 73===DONE===