From: Antony Dovgal Date: Tue, 19 Dec 2006 12:44:26 +0000 (+0000) Subject: MFB: serialize() should use '.' as decimal point irrespectively to locale X-Git-Tag: RELEASE_1_0_0RC1~647 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=b38466a816bfa87a83f6d0acef03abf9d251a112;p=php MFB: serialize() should use '.' as decimal point irrespectively to locale --- diff --git a/ext/standard/var.c b/ext/standard/var.c index 04fb08d448..d9fd977820 100644 --- a/ext/standard/var.c +++ b/ext/standard/var.c @@ -942,10 +942,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; }