]> granicus.if.org Git - php/commitdiff
serialize() should use '.' as decimal point irrespectively to locale
authorAntony Dovgal <tony2001@php.net>
Tue, 19 Dec 2006 12:36:44 +0000 (12:36 +0000)
committerAntony Dovgal <tony2001@php.net>
Tue, 19 Dec 2006 12:36:44 +0000 (12:36 +0000)
ext/standard/var.c

index 01b17506dd4d49945e94c19962d846ed6cf458bc..e71558cd9325373f3f82635b064d8e0258713f2b 100644 (file)
@@ -689,10 +689,12 @@ static void php_var_serialize_intern(smart_str *buf, zval *struc, HashTable *var
 
                case IS_DOUBLE: {
                                char *s;
-                               ulong slen;
 
-                               slen = spprintf(&s, 0, "d:%.*G;", (int) PG(serialize_precision), Z_DVAL_P(struc));
-                               smart_str_appendl(buf, s, slen);
+                               smart_str_appendl(buf, "d:", 2);
+                               s = (char *) emalloc(MAX_LENGTH_OF_DOUBLE + PG(serialize_precision) + 1);
+                               php_gcvt(Z_DVAL_P(struc), PG(serialize_precision), '.', 'E', s);
+                               smart_str_appends(buf, s);
+                               smart_str_appendc(buf, ';');
                                efree(s);
                                return;
                        }