cvs: php4 / php.ini-dist php.ini-recommended /ext/standard var.c /ext/standard/tests/serialize bug23298.phpt /main main.c php_globals.h

From: Date: Thu, 08 May 2003 01:23:21 +0000
Subject: cvs: php4 / php.ini-dist php.ini-recommended /ext/standard var.c /ext/standard/tests/serialize bug23298.phpt /main main.c php_globals.h
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-20778@lists.php.net to get a copy of this message
iliaa Wed May 7 21:23:21 2003 EDT Modified files: /php4 php.ini-dist php.ini-recommended /php4/main main.c php_globals.h /php4/ext/standard var.c /php4/ext/standard/tests/serialize bug23298.phpt Log: Make serialize precision a configurable option. Index: php4/php.ini-dist diff -u php4/php.ini-dist:1.190 php4/php.ini-dist:1.191 --- php4/php.ini-dist:1.190 Fri Apr 25 06:57:23 2003 +++ php4/php.ini-dist Wed May 7 21:23:20 2003 @@ -137,6 +137,11 @@ ; callback-function. unserialize_callback_func= +; When floats & doubles are serialized store serialize_precision significant +; digits after the floating point. The default value ensures that when floats +; are decoded with unserialize, the data will remain the same. +serialize_precision = 100 + ; Whether to enable the ability to force arguments to be passed by reference ; at function call time. This method is deprecated and is likely to be ; unsupported in future versions of PHP/Zend. The encouraged method of Index: php4/php.ini-recommended diff -u php4/php.ini-recommended:1.135 php4/php.ini-recommended:1.136 --- php4/php.ini-recommended:1.135 Sat Apr 5 06:38:13 2003 +++ php4/php.ini-recommended Wed May 7 21:23:20 2003 @@ -150,6 +150,11 @@ ; callback-function. unserialize_callback_func= +; When floats & doubles are serialized store serialize_precision significant +; digits after the floating point. The default value ensures that when floats +; are decoded with unserialize, the data will remain the same. +serialize_precision = 100 + ; Whether to enable the ability to force arguments to be passed by reference ; at function call time. This method is deprecated and is likely to be ; unsupported in future versions of PHP/Zend. The encouraged method of Index: php4/main/main.c diff -u php4/main/main.c:1.550 php4/main/main.c:1.551 --- php4/main/main.c:1.550 Tue May 6 21:02:23 2003 +++ php4/main/main.c Wed May 7 21:23:20 2003 @@ -18,7 +18,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: main.c,v 1.550 2003/05/07 01:02:23 helly Exp $ */ +/* $Id: main.c,v 1.551 2003/05/08 01:23:20 iliaa Exp $ */ /* {{{ includes */ @@ -296,6 +296,7 @@ STD_PHP_INI_BOOLEAN("y2k_compliance", "1", PHP_INI_ALL, OnUpdateBool, y2k_compliance, php_core_globals, core_globals) STD_PHP_INI_ENTRY("unserialize_callback_func", NULL, PHP_INI_ALL, OnUpdateString, unserialize_callback_func, php_core_globals, core_globals) + STD_PHP_INI_ENTRY("serialize_precision", "100", PHP_INI_ALL, OnUpdateLong, serialize_precision, php_core_globals, core_globals) STD_PHP_INI_ENTRY("arg_separator.output", "&", PHP_INI_ALL, OnUpdateStringUnempty, arg_separator.output, php_core_globals, core_globals) STD_PHP_INI_ENTRY("arg_separator.input", "&", PHP_INI_SYSTEM|PHP_INI_PERDIR, OnUpdateStringUnempty, arg_separator.input, php_core_globals, core_globals) Index: php4/main/php_globals.h diff -u php4/main/php_globals.h:1.91 php4/main/php_globals.h:1.92 --- php4/main/php_globals.h:1.91 Tue May 6 21:02:23 2003 +++ php4/main/php_globals.h Wed May 7 21:23:21 2003 @@ -16,7 +16,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: php_globals.h,v 1.91 2003/05/07 01:02:23 helly Exp $ */ +/* $Id: php_globals.h,v 1.92 2003/05/08 01:23:21 iliaa Exp $ */ #ifndef PHP_GLOBALS_H #define PHP_GLOBALS_H @@ -69,6 +69,7 @@ char *output_handler; char *unserialize_callback_func; + long serialize_precision; char *safe_mode_exec_dir; Index: php4/ext/standard/var.c diff -u php4/ext/standard/var.c:1.165 php4/ext/standard/var.c:1.166 --- php4/ext/standard/var.c:1.165 Mon May 5 18:21:29 2003 +++ php4/ext/standard/var.c Wed May 7 21:23:21 2003 @@ -18,7 +18,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: var.c,v 1.165 2003/05/05 22:21:29 iliaa Exp $ */ +/* $Id: var.c,v 1.166 2003/05/08 01:23:21 iliaa Exp $ */ /* {{{ includes @@ -535,7 +535,7 @@ char *s; ulong slen; - slen = spprintf(&s, 0, "d:%.100G;", Z_DVAL_PP(struc)); + slen = spprintf(&s, 0, "d:%.*G;", PG(serialize_precision), Z_DVAL_PP(struc)); smart_str_appendl(buf, s, slen); efree(s); return; Index: php4/ext/standard/tests/serialize/bug23298.phpt diff -u php4/ext/standard/tests/serialize/bug23298.phpt:1.1 php4/ext/standard/tests/serialize/bug23298.phpt:1.2 --- php4/ext/standard/tests/serialize/bug23298.phpt:1.1 Sun May 4 14:41:02 2003 +++ php4/ext/standard/tests/serialize/bug23298.phpt Wed May 7 21:23:21 2003 @@ -1,5 +1,7 @@ --TEST-- Bug #23298 (serialize() and floats/doubles) +--INI-- +serialize_precision=100 --FILE-- <?php ini_set('precision', 12);

« previous php.cvs (#20778) next »