iliaa           Mon Oct  1 15:23:15 2007 UTC

  Modified files:              (Branch: PHP_5_2)
    /php-src/main       snprintf.c spprintf.c 
    /php-src/ext/json   json.c 
    /php-src    NEWS 
  Log:
  
  MFB: Fixed bug #42785 (json_encode() formats doubles according to locale
  rather then following standard syntax).
  
http://cvs.php.net/viewvc.cgi/php-src/main/snprintf.c?r1=1.37.2.4.2.14&r2=1.37.2.4.2.15&diff_format=u
Index: php-src/main/snprintf.c
diff -u php-src/main/snprintf.c:1.37.2.4.2.14 
php-src/main/snprintf.c:1.37.2.4.2.15
--- php-src/main/snprintf.c:1.37.2.4.2.14       Fri Aug  3 14:31:27 2007
+++ php-src/main/snprintf.c     Mon Oct  1 15:23:15 2007
@@ -16,7 +16,7 @@
   +----------------------------------------------------------------------+
 */
 
-/* $Id: snprintf.c,v 1.37.2.4.2.14 2007/08/03 14:31:27 tony2001 Exp $ */
+/* $Id: snprintf.c,v 1.37.2.4.2.15 2007/10/01 15:23:15 iliaa Exp $ */
 
 
 #include "php.h"
@@ -1004,6 +1004,7 @@
 
 
                                case 'g':
+                               case 'k':
                                case 'G':
                                case 'H':
                                        switch(modifier) {
@@ -1045,7 +1046,7 @@
                                                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) {
http://cvs.php.net/viewvc.cgi/php-src/main/spprintf.c?r1=1.25.2.2.2.10&r2=1.25.2.2.2.11&diff_format=u
Index: php-src/main/spprintf.c
diff -u php-src/main/spprintf.c:1.25.2.2.2.10 
php-src/main/spprintf.c:1.25.2.2.2.11
--- php-src/main/spprintf.c:1.25.2.2.2.10       Fri Aug  3 14:31:28 2007
+++ php-src/main/spprintf.c     Mon Oct  1 15:23:15 2007
@@ -16,7 +16,7 @@
    +----------------------------------------------------------------------+
 */
 
-/* $Id: spprintf.c,v 1.25.2.2.2.10 2007/08/03 14:31:28 tony2001 Exp $ */
+/* $Id: spprintf.c,v 1.25.2.2.2.11 2007/10/01 15:23:15 iliaa Exp $ */
 
 /* This is the spprintf implementation.
  * It has emerged from apache snprintf. See original header:
@@ -600,6 +600,7 @@
 
 
                                case 'g':
+                               case 'k':
                                case 'G':
                                case 'H':
                                        switch(modifier) {
@@ -640,7 +641,7 @@
                                                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)
http://cvs.php.net/viewvc.cgi/php-src/ext/json/json.c?r1=1.9.2.19&r2=1.9.2.20&diff_format=u
Index: php-src/ext/json/json.c
diff -u php-src/ext/json/json.c:1.9.2.19 php-src/ext/json/json.c:1.9.2.20
--- php-src/ext/json/json.c:1.9.2.19    Tue Jul 24 22:57:13 2007
+++ php-src/ext/json/json.c     Mon Oct  1 15:23:15 2007
@@ -16,7 +16,7 @@
   +----------------------------------------------------------------------+
 */
 
-/* $Id: json.c,v 1.9.2.19 2007/07/24 22:57:13 bjori Exp $ */
+/* $Id: json.c,v 1.9.2.20 2007/10/01 15:23:15 iliaa Exp $ */
 
 #ifdef HAVE_CONFIG_H
 #include "config.h"
@@ -359,7 +359,7 @@
                 double dbl = Z_DVAL_P(val);
 
                 if (!zend_isinf(dbl) && !zend_isnan(dbl)) {
-                       len = spprintf(&d, 0, "%.*g", (int) EG(precision), dbl);
+                       len = spprintf(&d, 0, "%.*k", (int) EG(precision), dbl);
                        smart_str_appendl(buf, d, len);
                        efree(d);
                 } else {
http://cvs.php.net/viewvc.cgi/php-src/NEWS?r1=1.2027.2.547.2.965&r2=1.2027.2.547.2.966&diff_format=u
Index: php-src/NEWS
diff -u php-src/NEWS:1.2027.2.547.2.965 php-src/NEWS:1.2027.2.547.2.966
--- php-src/NEWS:1.2027.2.547.2.965     Wed Sep 26 15:44:15 2007
+++ php-src/NEWS        Mon Oct  1 15:23:15 2007
@@ -30,6 +30,8 @@
   Reported by Laurent gaffie. (Ilia)
 - Fixed imagerectangle regression with 1x1 rectangle (libgd #106). (Pierre)
 
+- Fixed bug #42785 (json_encode() formats doubles according to locale rather  
+  then following standard syntax). (Ilia)
 - Fixed bug #42767 (highlight_string() truncates trailing comment). (Ilia)
 - Fixed bug #42739 (mkdir() doesn't like a trailing slash when safe_mode is 
   enabled). (Ilia)

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to