cvs: php4(PHP_4_3) / php.ini-dist php.ini-recommended /ext/standard var.c /ext/standard/tests/serialize bug23298.phpt /main main.c php_globals.h
| From: | Ilia Alshanetsky | Date: | Thu, 08 May 2003 01:23:36 +0000 |
| Subject: | cvs: php4(PHP_4_3) / 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-20779@lists.php.net to get a copy of this message | ||
iliaa Wed May 7 21:23:36 2003 EDT
Modified files: (Branch: PHP_4_3)
/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:
MFH
Index: php4/php.ini-dist
diff -u php4/php.ini-dist:1.171.2.11 php4/php.ini-dist:1.171.2.12
--- php4/php.ini-dist:1.171.2.11 Sat Apr 5 06:40:40 2003
+++ php4/php.ini-dist Wed May 7 21:23:35 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.119.2.9 php4/php.ini-recommended:1.119.2.10
--- php4/php.ini-recommended:1.119.2.9 Sat Apr 5 06:40:40 2003
+++ php4/php.ini-recommended Wed May 7 21:23:35 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.512.2.27 php4/main/main.c:1.512.2.28
--- php4/main/main.c:1.512.2.27 Tue May 6 09:18:38 2003
+++ php4/main/main.c Wed May 7 21:23:35 2003
@@ -18,7 +18,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: main.c,v 1.512.2.27 2003/05/06 13:18:38 sas Exp $ */
+/* $Id: main.c,v 1.512.2.28 2003/05/08 01:23:35 iliaa Exp $ */
/* {{{ includes
*/
@@ -329,6 +329,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, OnUpdateInt, 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.84.2.3 php4/main/php_globals.h:1.84.2.4
--- php4/main/php_globals.h:1.84.2.3 Mon Mar 10 08:35:21 2003
+++ php4/main/php_globals.h Wed May 7 21:23:35 2003
@@ -67,6 +67,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.150.2.7 php4/ext/standard/var.c:1.150.2.8
--- php4/ext/standard/var.c:1.150.2.7 Mon May 5 18:21:37 2003
+++ php4/ext/standard/var.c Wed May 7 21:23:36 2003
@@ -514,7 +514,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.2.1
php4/ext/standard/tests/serialize/bug23298.phpt:1.1.2.2
--- php4/ext/standard/tests/serialize/bug23298.phpt:1.1.2.1 Sun May 4 14:41:37 2003
+++ php4/ext/standard/tests/serialize/bug23298.phpt Wed May 7 21:23:36 2003
@@ -1,5 +1,7 @@
--TEST--
Bug #23298 (serialize() and floats/doubles)
+--INI--
+serialize_precision=100
--FILE--
<?php
ini_set('precision', 12);