Bug #68264 [Opn->Csd]: Mysqli rounding bug in 4-byte float
Edit report at https://bugs.php.net/bug.php?id=68264&edit=1
ID: 68264
Updated by: nikic@php.net
Reported by: nikita at paymentwall dot com
Summary: Mysqli rounding bug in 4-byte float
-Status: Open
+Status: Closed
Type: Bug
Package: MySQLi related
Operating System: FreeBSD 10.0, FreeBSD 9.1
PHP Version: 5.4.34
-Assigned To:
+Assigned To: nikic
Block user comment: N
Private report: N
New Comment:
I believe the issue here was the use of a locale with a decimal separator other than ".".
That issue was fixed in https://github.com/php/php-src/commit/d1cd489a53c697898c2da5101c775bd6259f4be0.
If that wasn't the cause and this issue still exists, please tell me.
Previous Comments:
------------------------------------------------------------------------
[2014-10-19 08:36:13] nikita at paymentwall dot com
Description:
------------
Related bug: https://bugs.php.net/bug.php?id=67839
There is an issue which occurs in the "else" condition in mysqlnd_ps_codec.c on line 224
https://github.com/php/php-src/commit/c044164a96553668cc6c4ae1eb32f18219308851#diff-244e2eb2c3973758baa5d722dc42e7c0
------------
PHP version: 5.4.34
OS: FreeBSD 10.0, FreeBSD 9.1
Compiled with clang, not GCC
Test script:
---------------
CREATE TABLE test_php_bug(id INT PRIMARY KEY, fp4 FLOAT(8,2), fp8 DOUBLE) ENGINE = InnoDB;
INSERT INTO test_php_bug(id, fp4, fp8) VALUES (1, 38.50, 38.50);
if (!($stmt = mysqli_prepare($link, "SELECT id, fp4, fp8 FROM test_php_bug WHERE id=1")))
{
die();
}
if (!mysqli_stmt_execute($stmt)) {
die();
}
if (!($result = mysqli_stmt_get_result($stmt))) {
die();
}
$data = mysqli_fetch_assoc($result);
print $data['id'] . ": " . $data['fp4'] . ": " .
$data['fp8'] . "\n";
Expected result:
----------------
1: 38.5: 38.5
Actual result:
--------------
1: 38: 38.5
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=68264&edit=1
Thread (2 messages)