1--TEST--
2Test setlocale() function : error condition
3--INI--
4error_reporting=E_ALL
5--SKIPIF--
6<?php
7if (setlocale(LC_ALL, 'invalid') === 'invalid') { die('skip setlocale() is broken /w musl'); }
8if (substr(PHP_OS, 0, 3) == 'WIN') {
9    die('skip Not valid for windows');
10}
11?>
12--FILE--
13<?php
14echo "*** Testing setlocale() : error conditions ***\n";
15
16echo "\n-- Testing setlocale() function with invalid locale array, 'category' = LC_ALL --\n";
17//Invalid array of locales
18$invalid_locales = array("en_US.invalid", "en_AU.invalid", "ko_KR.invalid");
19var_dump( setlocale(LC_ALL,$invalid_locales) );
20
21echo "\n-- Testing setlocale() function with invalid multiple locales, 'category' = LC_ALL --\n";
22//Invalid array of locales
23var_dump( setlocale(LC_ALL,"en_US.invalid", "en_AU.invalid", "ko_KR.invalid") );
24
25echo "\n-- Testing setlocale() function with locale name too long, 'category' = LC_ALL --";
26//Invalid locale - locale name too long
27var_dump(setlocale(LC_ALL,str_pad('',255,'A')));
28
29echo "\nDone";
30?>
31--EXPECTF--
32*** Testing setlocale() : error conditions ***
33
34-- Testing setlocale() function with invalid locale array, 'category' = LC_ALL --
35bool(false)
36
37-- Testing setlocale() function with invalid multiple locales, 'category' = LC_ALL --
38bool(false)
39
40-- Testing setlocale() function with locale name too long, 'category' = LC_ALL --
41Warning: setlocale(): Specified locale name is too long in %s on line %d
42bool(false)
43
44Done
45