xref: /PHP-5.6/ext/gettext/tests/bug66267.phpt (revision 2e79820c)
1--TEST--
2#66265: gettext doesn't switch locales within the same script
3--SKIPIF--
4<?php
5if (!extension_loaded("gettext")) {
6	die("skip\n");
7}
8if (PHP_ZTS) {
9	/* this is supposed to fail on the TS build at least on Windows,
10	should be even XFAIL till it's fixed there */
11	die("skip NTS only");
12}
13if (substr(PHP_OS, 0, 3) != 'WIN') {
14	$loc = ["de_DE", "fr_FR", "en_US"];
15	foreach($loc as $l) {
16		if (!setlocale(LC_ALL, $l)) {
17			die("SKIP '$l' locale not supported.");
18		}
19	}
20}
21?>
22--FILE--
23<?php
24
25$domain = 'domain';
26
27$loc = ["de_DE", "fr_FR", "en_US"];
28
29foreach ($loc as $l) {
30	putenv("LC_ALL=$l");
31	setlocale(LC_ALL, $l);
32
33	$path = realpath(dirname(__FILE__) . DIRECTORY_SEPARATOR . "66265");
34	bindtextdomain($domain, $path);
35	bind_textdomain_codeset($domain, "UTF-8");
36	textdomain($domain);
37
38	echo 'LC_ALL=', getenv('LC_ALL'), "\n";
39	echo 'hello=', _('hello'), "\n";
40	echo "\n";
41}
42
43?>
44==DONE==
45--EXPECTF--
46LC_ALL=de_DE
47hello=hallo
48
49LC_ALL=fr_FR
50hello=salut
51
52LC_ALL=en_US
53hello=hello
54
55==DONE==
56
57