Merge branch 'PHP-7.3' into PHP-7.4

* PHP-7.3:
  Fix #79596: MySQL FLOAT truncates to int some locales
This commit is contained in:
Christoph M. Becker 2020-05-15 09:11:19 +02:00
commit 844a1245ef
3 changed files with 35 additions and 2 deletions

View file

@ -31,7 +31,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.
@ -42,7 +42,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);