--TEST--
Bug #23298 (serialize() and floats/doubles)
+--INI--
+serialize_precision=100
--FILE--
<?php
ini_set('precision', 12);
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;
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)
char *output_handler;
char *unserialize_callback_func;
+ long serialize_precision;
char *safe_mode_exec_dir;
; 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
; 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