summaryrefslogtreecommitdiff
path: root/main
diff options
context:
space:
mode:
authorIlia Alshanetsky <iliaa@php.net>2007-10-01 15:25:01 +0000
committerIlia Alshanetsky <iliaa@php.net>2007-10-01 15:25:01 +0000
commit6c4e9b52b98830f37d8048f2712bbb3911d10536 (patch)
tree5e06acaed0105b85c875569816e0d70bccd384b4 /main
parent5d68e6a71b4708091d92e21df40835cd4a3e12b5 (diff)
downloadphp-git-6c4e9b52b98830f37d8048f2712bbb3911d10536.tar.gz
MFB: Fixed bug #42785 (json_encode() formats doubles according to locale
rather then following standard syntax).
Diffstat (limited to 'main')
-rw-r--r--main/snprintf.c3
-rw-r--r--main/spprintf.c3
2 files changed, 4 insertions, 2 deletions
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)