summaryrefslogtreecommitdiff
path: root/ext/mysqlnd/mysql_float_to_double.h
diff options
context:
space:
mode:
authorChristoph M. Becker <cmbecker69@gmx.de>2020-05-15 09:12:56 +0200
committerChristoph M. Becker <cmbecker69@gmx.de>2020-05-15 09:13:22 +0200
commit2393692937a57b8b53adee37feb59a5f9d25254a (patch)
tree8702751c43307ea42b7d107d0c0cbd1559b19789 /ext/mysqlnd/mysql_float_to_double.h
parent3771d6f8a1f4467bdc5caee2c54a4c808716a49b (diff)
parent844a1245ef4ec9b57fb1ca10ed87689cfb652dd4 (diff)
downloadphp-git-2393692937a57b8b53adee37feb59a5f9d25254a.tar.gz
Merge branch 'PHP-7.4'
* PHP-7.4: Fix #79596: MySQL FLOAT truncates to int some locales
Diffstat (limited to 'ext/mysqlnd/mysql_float_to_double.h')
-rw-r--r--ext/mysqlnd/mysql_float_to_double.h4
1 files changed, 2 insertions, 2 deletions
diff --git a/ext/mysqlnd/mysql_float_to_double.h b/ext/mysqlnd/mysql_float_to_double.h
index 2d4d4809cd..ee3b651c20 100644
--- a/ext/mysqlnd/mysql_float_to_double.h
+++ b/ext/mysqlnd/mysql_float_to_double.h
@@ -29,7 +29,7 @@
/*
* Convert from a 4-byte float to a 8-byte decimal by first converting
- * the float to a string, and then the string to a double.
+ * the float to a string (ignoring localization), and then the string to a double.
* The decimals argument specifies the precision of the output. If decimals
* is less than zero, then a gcvt(3) like logic is used with the significant
* digits set to FLT_DIG i.e. 6.
@@ -40,7 +40,7 @@ static inline double mysql_float_to_double(float fp4, int decimals) {
if (decimals < 0) {
php_gcvt(fp4, FLT_DIG, '.', 'e', num_buf);
} else {
- sprintf(num_buf, "%.*f", decimals, fp4);
+ snprintf(num_buf, MAX_CHAR_BUF_LEN, "%.*F", decimals, fp4);
}
return zend_strtod(num_buf, NULL);