1
0
mirror of https://github.com/php/php-src.git synced 2026-04-28 02:33:17 +02:00

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
This commit is contained in:
Dmitry Stogov
2020-05-15 10:44:14 +03:00
3 changed files with 39 additions and 3 deletions
+2 -2
View File
@@ -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);
+30
View File
@@ -0,0 +1,30 @@
--TEST--
Bug #79596 (MySQL FLOAT truncates to int some locales)
--SKIPIF--
<?php
require_once(__DIR__ . DIRECTORY_SEPARATOR . 'skipif.inc');
require_once(__DIR__ . DIRECTORY_SEPARATOR . 'mysql_pdo_test.inc');
MySQLPDOTest::skip();
if (!setlocale(LC_ALL, 'de_DE', 'de-DE')) die('skip German locale not available');
?>
--FILE--
<?php
require_once(__DIR__ . DIRECTORY_SEPARATOR . 'mysql_pdo_test.inc');
setlocale(LC_ALL, 'de_DE', 'de-DE');
$pdo = MySQLPDOTest::factory();
$pdo->setAttribute(\PDO::ATTR_EMULATE_PREPARES, false);
$pdo->query('CREATE TABLE bug79596 (broken FLOAT(2,1))');
$pdo->query('INSERT INTO bug79596 VALUES(4.9)');
var_dump($pdo->query('SELECT broken FROM bug79596')->fetchColumn(0));
?>
--CLEAN--
<?php
require_once(__DIR__ . DIRECTORY_SEPARATOR . 'mysql_pdo_test.inc');
$pdo = MySQLPDOTest::factory();
$pdo->exec("DROP TABLE IF EXISTS bug79596");
?>
--EXPECT--
float(4.9)
+7 -1
View File
@@ -438,7 +438,13 @@ PHP_WINUTIL_API char *php_win32_get_username(void)
static zend_always_inline BOOL is_compatible(const char *name, BOOL is_smaller, char *format, char **err)
{/*{{{*/
PLOADED_IMAGE img = ImageLoad(name, NULL);
/* work around ImageLoad() issue */
char *name_stripped = name;
if (name[0] == '.' && IS_SLASH(name[1])) {
name_stripped += 2;
}
PLOADED_IMAGE img = ImageLoad(name_stripped, NULL);
if (!img) {
DWORD _err = GetLastError();