cvs: php4 /ext/standard var.c /ext/standard/tests/serialize bug23298.phpt

From: Date: Sun, 04 May 2003 18:41:02 +0000
Subject: cvs: php4 /ext/standard var.c /ext/standard/tests/serialize bug23298.phpt
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-20683@lists.php.net to get a copy of this message
iliaa Sun May 4 14:41:02 2003 EDT Added files: /php4/ext/standard/tests/serialize bug23298.phpt Modified files: /php4/ext/standard var.c Log: Fixed bug #23298 (serialize cuts off floats & doubles) Index: php4/ext/standard/var.c diff -u php4/ext/standard/var.c:1.162 php4/ext/standard/var.c:1.163 --- php4/ext/standard/var.c:1.162 Mon Apr 28 14:52:59 2003 +++ php4/ext/standard/var.c Sun May 4 14:41:02 2003 @@ -18,7 +18,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: var.c,v 1.162 2003/04/28 18:52:59 derick Exp $ */ +/* $Id: var.c,v 1.163 2003/05/04 18:41:02 iliaa Exp $ */ /* {{{ includes @@ -535,7 +535,7 @@ char s[256]; ulong slen; - slen = sprintf(s, "d:%.*G;", (int) EG(precision), Z_DVAL_PP(struc)); + slen = sprintf(s, "d:%.252g;", Z_DVAL_PP(struc)); smart_str_appendl(buf, s, slen); return; } Index: php4/ext/standard/tests/serialize/bug23298.phpt +++ php4/ext/standard/tests/serialize/bug23298.phpt --TEST-- Bug #23298 (serialize() and floats/doubles) --FILE-- <?php ini_set('precision', 12); $foo = 1.428571428571428647642857142; $bar = unserialize(serialize($foo)); var_dump(($foo === $bar)); ?> --EXPECT-- bool(true)

« previous php.cvs (#20683) next »