xref: /PHP-5.5/ext/gettext/tests/bug66267.phpt (revision 59a9e7af)
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
32	$path = realpath(dirname(__FILE__) . DIRECTORY_SEPARATOR . "66265");
33	bindtextdomain($domain, $path);
34	bind_textdomain_codeset($domain, "UTF-8");
35	textdomain($domain);
36
37	echo 'LC_ALL=', getenv('LC_ALL'), "\n";
38	echo 'hello=', _('hello'), "\n";
39	echo "\n";
40}
41
42?>
43==DONE==
44--EXPECTF--
45LC_ALL=de_DE
46hello=hallo
47
48LC_ALL=fr_FR
49hello=salut
50
51LC_ALL=en_US
52hello=hello
53
54==DONE==
55
56