1--TEST-- 2Test setlocale() function : error condition 3--INI-- 4error_reporting=14335 5--SKIPIF-- 6<?php 7if (substr(PHP_OS, 0, 3) == 'WIN') { 8 die('skip Not valid for windows'); 9} 10?> 11--FILE-- 12<?php 13/* Prototype : string setlocale (int $category , string $locale [,string $..] ) 14 : string setlocale(int $category , array $locale); 15 * Description: Sets locale information.Returns the new current locale , or FALSE if locale functinality is not implemented in this platform. 16 * Source code: ext/standard/string.c 17*/ 18 19echo "*** Testing setlocale() : error conditions ***\n"; 20 21// Zero argument 22echo "\n-- Testing setlocale() function with Zero arguments --"; 23var_dump( setlocale()); 24 25// One argument 26echo "\n-- Testing setlocale() function with One argument, 'category' = LC_ALL --"; 27var_dump( setlocale(LC_ALL) ); 28 29echo "\n-- Testing setlocale() function with invalid locale array, 'category' = LC_ALL --\n"; 30//Invalid array of locales 31$invalid_locales = array("en_US.invalid", "en_AU.invalid", "ko_KR.invalid"); 32var_dump( setlocale(LC_ALL,$invalid_locales) ); 33 34echo "\n-- Testing setlocale() function with invalid multiple locales, 'category' = LC_ALL --\n"; 35//Invalid array of locales 36var_dump( setlocale(LC_ALL,"en_US.invalid", "en_AU.invalid", "ko_KR.invalid") ); 37 38echo "\n-- Testing setlocale() function with invalid category --\n"; 39//invalid $category 40$invalid_category = "TEST"; 41var_dump( setlocale($invalid_category,"en_US.utf8") ); 42 43echo "\nDone"; 44?> 45--EXPECTF-- 46*** Testing setlocale() : error conditions *** 47 48-- Testing setlocale() function with Zero arguments -- 49Warning: setlocale() expects at least 2 parameters, 0 given in %s on line %d 50NULL 51 52-- Testing setlocale() function with One argument, 'category' = LC_ALL -- 53Warning: setlocale() expects at least 2 parameters, 1 given in %s on line %d 54NULL 55 56-- Testing setlocale() function with invalid locale array, 'category' = LC_ALL -- 57bool(false) 58 59-- Testing setlocale() function with invalid multiple locales, 'category' = LC_ALL -- 60bool(false) 61 62-- Testing setlocale() function with invalid category -- 63 64Deprecated: setlocale(): Passing locale category name as string is deprecated. Use the LC_* -constants instead in %s on line %d 65 66Warning: setlocale(): Invalid locale category name TEST, must be one of LC_ALL, LC_COLLATE, LC_CTYPE, LC_MONETARY, LC_NUMERIC, or LC_TIME in %s on line %d 67bool(false) 68 69Done 70