From 6c4e9b52b98830f37d8048f2712bbb3911d10536 Mon Sep 17 00:00:00 2001 From: Ilia Alshanetsky Date: Mon, 1 Oct 2007 15:25:01 +0000 Subject: MFB: Fixed bug #42785 (json_encode() formats doubles according to locale rather then following standard syntax). --- main/snprintf.c | 3 ++- main/spprintf.c | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) (limited to 'main') diff --git a/main/snprintf.c b/main/snprintf.c index f24b146944..d70286fa5a 100644 --- a/main/snprintf.c +++ b/main/snprintf.c @@ -1051,6 +1051,7 @@ fmt_string: case 'g': + case 'k': case 'G': case 'H': switch(modifier) { @@ -1091,7 +1092,7 @@ fmt_string: lconv = localeconv(); } #endif - s = php_gcvt(fp_num, precision, *fmt=='H' ? '.' : LCONV_DECIMAL_POINT, (*fmt == 'G' || *fmt == 'H')?'E':'e', &num_buf[1]); + s = php_gcvt(fp_num, precision, (*fmt == 'H' || *fmt == 'k') ? '.' : LCONV_DECIMAL_POINT, (*fmt == 'G' || *fmt == 'H')?'E':'e', &num_buf[1]); if (*s == '-') prefix_char = *s++; else if (print_sign) diff --git a/main/spprintf.c b/main/spprintf.c index 6e2661c4f4..26052150a6 100644 --- a/main/spprintf.c +++ b/main/spprintf.c @@ -690,6 +690,7 @@ fmt_string: case 'g': + case 'k': case 'G': case 'H': switch(modifier) { @@ -730,7 +731,7 @@ fmt_string: lconv = localeconv(); } #endif - s = php_gcvt(fp_num, precision, *fmt=='H' ? '.' : LCONV_DECIMAL_POINT, (*fmt == 'G' || *fmt == 'H')?'E':'e', &num_buf[1]); + s = php_gcvt(fp_num, precision, (*fmt=='H' || *fmt == 'k') ? '.' : LCONV_DECIMAL_POINT, (*fmt == 'G' || *fmt == 'H')?'E':'e', &num_buf[1]); if (*s == '-') prefix_char = *s++; else if (print_sign) -- cgit v1.2.1