Skip to content

Commit 0e09e5e

Browse files
committed
Merge branch 'PHP-5.5' into PHP-5.6
* PHP-5.5: Fixed bug #65769 localeconv() broken in TS builds
2 parents fa863c9 + 7943f94 commit 0e09e5e

File tree

2 files changed

+90
-0
lines changed

2 files changed

+90
-0
lines changed

ext/standard/string.c

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -198,8 +198,18 @@ PHPAPI struct lconv *localeconv_r(struct lconv *out)
198198
tsrm_mutex_lock( locale_mutex );
199199
# endif
200200

201+
#if defined(PHP_WIN32) && defined(ZTS)
202+
{
203+
/* Even with the enabled per thread locale, localeconv
204+
won't check any locale change in the master thread. */
205+
_locale_t cur = _get_current_locale();
206+
207+
res = cur->locinfo->lconv;
208+
}
209+
#else
201210
/* localeconv doesn't return an error condition */
202211
res = localeconv();
212+
#endif
203213

204214
*out = *res;
205215

Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
--TEST--
2+
Bug #65769 localeconv() broken in TS builds
3+
--SKIPIF--
4+
<?php
5+
if (substr(PHP_OS, 0, 3) != 'WIN') {
6+
die('skip Windows only');
7+
}
8+
?>
9+
--FILE--
10+
<?php
11+
12+
$locales = array('sve', 'french', 'us', 'ru', 'czech', 'serbian');
13+
14+
foreach ($locales as $locale) {
15+
$locale = setlocale(LC_ALL, $locale);
16+
$lconv = localeconv();
17+
var_dump(
18+
$locale,
19+
$lconv['decimal_point'],
20+
$lconv['thousands_sep'],
21+
$lconv['int_curr_symbol'],
22+
$lconv['currency_symbol'],
23+
$lconv['mon_decimal_point'],
24+
$lconv['mon_thousands_sep']
25+
);
26+
echo '++++++++++++++++++++++', "\n";
27+
}
28+
29+
?>
30+
+++DONE+++
31+
--EXPECTF--
32+
string(19) "Swedish_Sweden.1252"
33+
string(1) ","
34+
string(1) " "
35+
string(3) "SEK"
36+
string(2) "kr"
37+
string(1) ","
38+
string(1) "."
39+
++++++++++++++++++++++
40+
string(18) "French_France.1252"
41+
string(1) ","
42+
string(1) " "
43+
string(3) "EUR"
44+
string(1) "€"
45+
string(1) ","
46+
string(1) " "
47+
++++++++++++++++++++++
48+
string(26) "English_United States.1252"
49+
string(1) "."
50+
string(1) ","
51+
string(3) "USD"
52+
string(1) "$"
53+
string(1) "."
54+
string(1) ","
55+
++++++++++++++++++++++
56+
string(2) "ru"
57+
string(1) ","
58+
string(1) " "
59+
string(3) "RUB"
60+
string(1) "?"
61+
string(1) ","
62+
string(1) " "
63+
++++++++++++++++++++++
64+
string(25) "Czech_Czech Republic.1250"
65+
string(1) ","
66+
string(1) " "
67+
string(3) "CZK"
68+
string(2) "Kè"
69+
string(1) ","
70+
string(1) " "
71+
++++++++++++++++++++++
72+
string(19) "Serbian_Serbia.1250"
73+
string(1) ","
74+
string(1) "."
75+
string(3) "RSD"
76+
string(4) "din."
77+
string(1) ","
78+
string(1) "."
79+
++++++++++++++++++++++
80+
+++DONE+++

0 commit comments

Comments
 (0)