diff options
author | Anatol Belski <ab@php.net> | 2014-12-06 12:01:09 +0100 |
---|---|---|
committer | Anatol Belski <ab@php.net> | 2014-12-06 12:01:09 +0100 |
commit | 3d68d843cb21d7147164dd4599e99afb456790c8 (patch) | |
tree | ee44e390cd86ba7f7c5eb569b94e04c27859d651 /ext/standard/formatted_print.c | |
parent | 0d76e16504137bc096667cc5e25a9238b7a3d8a6 (diff) | |
parent | 8d791399807f075295f2032f60ddee802323fad9 (diff) | |
download | php-git-3d68d843cb21d7147164dd4599e99afb456790c8.tar.gz |
Merge branch 'PHP-5.6'
* PHP-5.6:
updated NEWS
Fixed bug #65230 setting locale randomly broken
Diffstat (limited to 'ext/standard/formatted_print.c')
-rw-r--r-- | ext/standard/formatted_print.c | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/ext/standard/formatted_print.c b/ext/standard/formatted_print.c index f84075440b..2efd16247f 100644 --- a/ext/standard/formatted_print.c +++ b/ext/standard/formatted_print.c @@ -27,7 +27,11 @@ #ifdef HAVE_LOCALE_H #include <locale.h> +#ifdef ZTS +#define LCONV_DECIMAL_POINT (*lconv.decimal_point) +#else #define LCONV_DECIMAL_POINT (*lconv->decimal_point) +#endif #else #define LCONV_DECIMAL_POINT '.' #endif @@ -211,8 +215,12 @@ php_sprintf_appenddouble(zend_string **buffer, size_t *pos, size_t s_len = 0; int is_negative = 0; #ifdef HAVE_LOCALE_H +#ifdef ZTS + struct lconv lconv; +#else struct lconv *lconv; #endif +#endif PRINTF_DEBUG(("sprintf: appenddouble(%x, %x, %x, %f, %d, '%c', %d, %c)\n", *buffer, pos, &(*buffer)->len, number, width, padding, alignment, fmt)); @@ -243,8 +251,12 @@ php_sprintf_appenddouble(zend_string **buffer, size_t *pos, case 'f': case 'F': #ifdef HAVE_LOCALE_H +#ifdef ZTS + localeconv_r(&lconv); +#else lconv = localeconv(); #endif +#endif s = php_conv_fp((fmt == 'f')?'F':fmt, number, 0, precision, (fmt == 'f')?LCONV_DECIMAL_POINT:'.', &is_negative, &num_buf[1], &s_len); @@ -267,8 +279,12 @@ php_sprintf_appenddouble(zend_string **buffer, size_t *pos, * * We use &num_buf[ 1 ], so that we have room for the sign */ #ifdef HAVE_LOCALE_H +#ifdef ZTS + localeconv_r(&lconv); +#else lconv = localeconv(); #endif +#endif s = php_gcvt(number, precision, LCONV_DECIMAL_POINT, (fmt == 'G')?'E':'e', &num_buf[1]); is_negative = 0; if (*s == '-') { |