Skip to content

Commit 7943f94

Browse files
committed
Fixed bug #65769 localeconv() broken in TS builds
1 parent 1e40b0a commit 7943f94

File tree

3 files changed

+91
-0
lines changed

3 files changed

+91
-0
lines changed

NEWS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ PHP NEWS
99
. Fixed bug #55541 (errors spawn MessageBox, which blocks test automation).
1010
(Anatol)
1111
. Fixed bug #68297 (Application Popup provides too few information). (Anatol)
12+
. Fixed bug #65769 (localeconv() broken in TS builds). (Anatol)
1213

1314
- cURL:
1415
. Fixed bug #67643 (curl_multi_getcontent returns '' when

ext/standard/string.c

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

206+
#if defined(PHP_WIN32) && defined(ZTS)
207+
{
208+
/* Even with the enabled per thread locale, localeconv
209+
won't check any locale change in the master thread. */
210+
_locale_t cur = _get_current_locale();
211+
212+
res = cur->locinfo->lconv;
213+
}
214+
#else
206215
/* localeconv doesn't return an error condition */
207216
res = localeconv();
217+
#endif
208218

209219
*out = *res;
210220

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)