summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ext/standard/formatted_print.c12
-rw-r--r--ext/standard/string.c13
2 files changed, 15 insertions, 10 deletions
diff --git a/ext/standard/formatted_print.c b/ext/standard/formatted_print.c
index a80913d85f..38f4e2c21c 100644
--- a/ext/standard/formatted_print.c
+++ b/ext/standard/formatted_print.c
@@ -284,14 +284,7 @@ php_sprintf_appenddouble(char **buffer, int *pos,
char *cvt;
register int i = 0, j = 0;
int sign, decpt;
- char decimal_point = '.';
-#ifdef HAVE_LOCALECONV
- struct lconv l;
-
- localeconv_r(&l);
-
- decimal_point = l.decimal_point[0];
-#endif
+ char decimal_point = EG(float_separator)[0];
PRINTF_DEBUG(("sprintf: appenddouble(%x, %x, %x, %f, %d, '%c', %d, %c)\n",
*buffer, pos, size, number, width, padding, alignment, fmt));
@@ -611,14 +604,13 @@ php_formatted_print(int ht, int *len, int use_array TSRMLS_DC)
case 'e':
case 'f':
/* XXX not done */
- convert_to_double_ex(args[argnum]);
php_sprintf_appenddouble(&result, &outpos, &size,
Z_DVAL_PP(args[argnum]),
width, padding, alignment,
precision, adjusting,
format[inpos], always_sign);
break;
-
+
case 'c':
convert_to_long_ex(args[argnum]);
php_sprintf_appendchar(&result, &outpos, &size,
diff --git a/ext/standard/string.c b/ext/standard/string.c
index c795394fdf..933b09587f 100644
--- a/ext/standard/string.c
+++ b/ext/standard/string.c
@@ -3216,6 +3216,19 @@ PHP_FUNCTION(setlocale)
efree(args);
RETVAL_STRING(retval, 1);
+
+ if (cat == LC_NUMERIC || cat == LC_ALL) {
+ struct lconv *lc;
+ lc = localeconv();
+
+ EG(float_separator)[0] = (lc->decimal_point)[0];
+
+ if ((lc->decimal_point)[0] != '.') {
+ /* set locale back to C */
+ setlocale(LC_NUMERIC, "C");
+ }
+ }
+
return;
}