iliaa           Mon Oct  1 15:22:41 2007 UTC

  Modified files:              (Branch: PHP_5_3)
    /php-src/main       snprintf.c spprintf.c 
    /php-src/ext/json   json.c 
  Log:
  
  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.14.2.1&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.14.2.1
--- 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:22:41 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.14.2.1 2007/10/01 15:22:41 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.10.2.1&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.10.2.1
--- 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:22:41 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.10.2.1 2007/10/01 15:22:41 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.2.1&r2=1.9.2.19.2.2&diff_format=u
Index: php-src/ext/json/json.c
diff -u php-src/ext/json/json.c:1.9.2.19.2.1 
php-src/ext/json/json.c:1.9.2.19.2.2
--- php-src/ext/json/json.c:1.9.2.19.2.1        Thu Sep 27 18:00:39 2007
+++ php-src/ext/json/json.c     Mon Oct  1 15:22:41 2007
@@ -16,7 +16,7 @@
   +----------------------------------------------------------------------+
 */
 
-/* $Id: json.c,v 1.9.2.19.2.1 2007/09/27 18:00:39 dmitry Exp $ */
+/* $Id: json.c,v 1.9.2.19.2.2 2007/10/01 15:22:41 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 {

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

Reply via email to