summaryrefslogtreecommitdiff
path: root/ext/mysqlnd/mysql_float_to_double.h
diff options
context:
space:
mode:
authorDmitry Stogov <dmitry@zend.com>2020-05-15 10:44:14 +0300
committerDmitry Stogov <dmitry@zend.com>2020-05-15 10:44:14 +0300
commitba0731cd53b47de1d1dbadb63079da636b579fed (patch)
treef0d95aef37ca5266faaa3d1fab4494f4aeecbbd5 /ext/mysqlnd/mysql_float_to_double.h
parente5e25d635273b6d40909e74fa7ff5493a4a12ce9 (diff)
parentc91f3497176479a9de5fa4adea6149c8cdc8f424 (diff)
downloadphp-git-ba0731cd53b47de1d1dbadb63079da636b579fed.tar.gz
Merge branch 'master' of git.php.net:php-src
* 'master' of git.php.net:php-src: fixed typo of bug id (#79599) master doesn't been affected since we are not passing errcontext now Fixed bug #97599 (coredump in set_error_handler) Fix #79557: extension_dir = ./ext now use current directory for base Fix #79596: MySQL FLOAT truncates to int some locales [ci skip] Fix NEWS
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);