iliaa Mon Jun 4 23:51:33 2007 UTC
Added files: (Branch: PHP_5_2)
/php-src/ext/json/tests bug41567.phpt
Modified files:
/php-src NEWS
/php-src/ext/json json.c
Log:
Fixed bug #41567 (json_encode() double conversion is inconsistent with PHP).
http://cvs.php.net/viewvc.cgi/php-src/NEWS?r1=1.2027.2.547.2.756&r2=1.2027.2.547.2.757&diff_format=u
Index: php-src/NEWS
diff -u php-src/NEWS:1.2027.2.547.2.756 php-src/NEWS:1.2027.2.547.2.757
--- php-src/NEWS:1.2027.2.547.2.756 Mon Jun 4 15:39:26 2007
+++ php-src/NEWS Mon Jun 4 23:51:32 2007
@@ -11,6 +11,8 @@
GD_RELEASE_VERSION, GD_EXTRA_VERSION and GD_VERSION_STRING. (Pierre)
- Fixed bug #41576 (configure failure when using --without-apxs or some
other SAPIs disabling options). (Jani)
+- Fixed bug #41567 (json_encode() double conversion is inconsistent with
+ PHP). (Lucas, Ilia)
- Fixed bug #41555 (configure failure: regression caused by fix for #41265).
(Jani)
- Fixed bug #41518 (file_exists() warns of open_basedir restriction on
http://cvs.php.net/viewvc.cgi/php-src/ext/json/json.c?r1=1.9.2.15&r2=1.9.2.16&diff_format=u
Index: php-src/ext/json/json.c
diff -u php-src/ext/json/json.c:1.9.2.15 php-src/ext/json/json.c:1.9.2.16
--- php-src/ext/json/json.c:1.9.2.15 Fri May 25 13:24:50 2007
+++ php-src/ext/json/json.c Mon Jun 4 23:51:32 2007
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: json.c,v 1.9.2.15 2007/05/25 13:24:50 bjori Exp $ */
+/* $Id: json.c,v 1.9.2.16 2007/06/04 23:51:32 iliaa Exp $ */
#ifdef HAVE_CONFIG_H
#include "config.h"
@@ -354,7 +354,7 @@
double dbl = Z_DVAL_P(val);
if (!zend_isinf(dbl) && !zend_isnan(dbl)) {
- len = spprintf(&d, 0, "%.9g", dbl);
+ len = spprintf(&d, 0, "%.*g", (int) EG(precision), dbl);
if (d) {
if (dbl > LONG_MAX && !memchr(d, '.', len)) {
smart_str_append_unsigned(buf,
(unsigned long)Z_DVAL_P(val));
http://cvs.php.net/viewvc.cgi/php-src/ext/json/tests/bug41567.phpt?view=markup&rev=1.1
Index: php-src/ext/json/tests/bug41567.phpt
+++ php-src/ext/json/tests/bug41567.phpt
--
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php