php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login

Patch json-invalid-printf-conversion-type-k-patch for Compile Warning Bug #66674

Patch version 2014-02-08 12:24 UTC

Return to Bug #66674 | Download this patch
Patch Revisions:

Developer: tom@bignm.com

--- json.c	2014-02-08 09:22:33.873425390 -0300
+++ json.c.new	2014-02-08 09:22:00.943377097 -0300
@@ -405,7 +405,7 @@
 			} else if (type == IS_DOUBLE) {
 				if (!zend_isinf(d) && !zend_isnan(d)) {
 					char *tmp;
-					int l = spprintf(&tmp, 0, "%.*k", (int) EG(precision), d);
+					int l = spprintf(&tmp, 0, "%.*g", (int) EG(precision), d);
 					smart_str_appendl(buf, tmp, l);
 					efree(tmp);
 				} else {
@@ -616,7 +616,7 @@
 				double dbl = Z_DVAL_P(val);
 
 				if (!zend_isinf(dbl) && !zend_isnan(dbl)) {
-					len = spprintf(&d, 0, "%.*k", (int) EG(precision), dbl);
+					len = spprintf(&d, 0, "%.*g", (int) EG(precision), dbl);
 					smart_str_appendl(buf, d, len);
 					efree(d);
 				} else {
 
PHP Copyright © 2001-2021 The PHP Group
All rights reserved.
Last updated: Mon Dec 06 23:03:35 2021 UTC