From 7943f944c2646f71daf5feb9a0d2f84ec368c1c5 Mon Sep 17 00:00:00 2001 From: Anatol Belski Date: Fri, 5 Dec 2014 11:06:06 +0100 Subject: [PATCH 1/2] Fixed bug #65769 localeconv() broken in TS builds --- NEWS | 1 + ext/standard/string.c | 10 +++ ext/standard/tests/strings/bug65769.phpt | 80 ++++++++++++++++++++++++ 3 files changed, 91 insertions(+) create mode 100644 ext/standard/tests/strings/bug65769.phpt diff --git a/NEWS b/NEWS index 73b90f85f3d..c0f1739e1c9 100644 --- a/NEWS +++ b/NEWS @@ -9,6 +9,7 @@ PHP NEWS . Fixed bug #55541 (errors spawn MessageBox, which blocks test automation). (Anatol) . Fixed bug #68297 (Application Popup provides too few information). (Anatol) + . Fixed bug #65769 (localeconv() broken in TS builds). (Anatol) - cURL: . Fixed bug #67643 (curl_multi_getcontent returns '' when diff --git a/ext/standard/string.c b/ext/standard/string.c index 62122cf1dc8..3581e7c6c58 100644 --- a/ext/standard/string.c +++ b/ext/standard/string.c @@ -203,8 +203,18 @@ PHPAPI struct lconv *localeconv_r(struct lconv *out) tsrm_mutex_lock( locale_mutex ); # endif +#if defined(PHP_WIN32) && defined(ZTS) + { + /* Even with the enabled per thread locale, localeconv + won't check any locale change in the master thread. */ + _locale_t cur = _get_current_locale(); + + res = cur->locinfo->lconv; + } +#else /* localeconv doesn't return an error condition */ res = localeconv(); +#endif *out = *res; diff --git a/ext/standard/tests/strings/bug65769.phpt b/ext/standard/tests/strings/bug65769.phpt new file mode 100644 index 00000000000..15dad45bd5e --- /dev/null +++ b/ext/standard/tests/strings/bug65769.phpt @@ -0,0 +1,80 @@ +--TEST-- +Bug #65769 localeconv() broken in TS builds +--SKIPIF-- + +--FILE-- + ++++DONE+++ +--EXPECTF-- +string(19) "Swedish_Sweden.1252" +string(1) "," +string(1) " " +string(3) "SEK" +string(2) "kr" +string(1) "," +string(1) "." +++++++++++++++++++++++ +string(18) "French_France.1252" +string(1) "," +string(1) " " +string(3) "EUR" +string(1) "€" +string(1) "," +string(1) " " +++++++++++++++++++++++ +string(26) "English_United States.1252" +string(1) "." +string(1) "," +string(3) "USD" +string(1) "$" +string(1) "." +string(1) "," +++++++++++++++++++++++ +string(2) "ru" +string(1) "," +string(1) " " +string(3) "RUB" +string(1) "?" +string(1) "," +string(1) " " +++++++++++++++++++++++ +string(25) "Czech_Czech Republic.1250" +string(1) "," +string(1) " " +string(3) "CZK" +string(2) "Kč" +string(1) "," +string(1) " " +++++++++++++++++++++++ +string(19) "Serbian_Serbia.1250" +string(1) "," +string(1) "." +string(3) "RSD" +string(4) "din." +string(1) "," +string(1) "." +++++++++++++++++++++++ ++++DONE+++ From fa863c9ea3986ef701edf86df3e798b1042d7eff Mon Sep 17 00:00:00 2001 From: Anatol Belski Date: Fri, 5 Dec 2014 11:08:32 +0100 Subject: [PATCH 2/2] updated NEWS --- NEWS | 1 + 1 file changed, 1 insertion(+) diff --git a/NEWS b/NEWS index ac8e8efd6a7..132d9e1c30e 100644 --- a/NEWS +++ b/NEWS @@ -10,6 +10,7 @@ PHP NEWS . Fixed bug #55541 (errors spawn MessageBox, which blocks test automation). (Anatol) . Fixed bug #68297 (Application Popup provides too few information). (Anatol) + . Fixed bug #65769 (localeconv() broken in TS builds). (Anatol) - cURL: . Fixed bug #67643 (curl_multi_getcontent returns '' when