Bug #68264 [NEW]: Mysqli rounding bug in 4-byte float

From: Date: Sun, 19 Oct 2014 08:36:14 +0000
Subject: Bug #68264 [NEW]: Mysqli rounding bug in 4-byte float
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-188187@lists.php.net to get a copy of this message
From: nikita at paymentwall dot com Operating system: FreeBSD 10.0, FreeBSD 9.1 PHP version: 5.4.34 Package: MySQLi related Bug Type: Bug Bug description:Mysqli rounding bug in 4-byte float 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 bug report at https://bugs.php.net/bug.php?id=68264&edit=1 -- Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=68264&r=trysnapshot54 Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=68264&r=trysnapshot55 Try a snapshot (trunk): https://bugs.php.net/fix.php?id=68264&r=trysnapshottrunk Fixed in SVN: https://bugs.php.net/fix.php?id=68264&r=fixed Fixed in release: https://bugs.php.net/fix.php?id=68264&r=alreadyfixed Need backtrace: https://bugs.php.net/fix.php?id=68264&r=needtrace Need Reproduce Script: https://bugs.php.net/fix.php?id=68264&r=needscript Try newer version: https://bugs.php.net/fix.php?id=68264&r=oldversion Not developer issue: https://bugs.php.net/fix.php?id=68264&r=support Expected behavior: https://bugs.php.net/fix.php?id=68264&r=notwrong Not enough info: https://bugs.php.net/fix.php?id=68264&r=notenoughinfo Submitted twice: https://bugs.php.net/fix.php?id=68264&r=submittedtwice register_globals: https://bugs.php.net/fix.php?id=68264&r=globals PHP 4 support discontinued: https://bugs.php.net/fix.php?id=68264&r=php4 Daylight Savings: https://bugs.php.net/fix.php?id=68264&r=dst IIS Stability: https://bugs.php.net/fix.php?id=68264&r=isapi Install GNU Sed: https://bugs.php.net/fix.php?id=68264&r=gnused Floating point limitations: https://bugs.php.net/fix.php?id=68264&r=float No Zend Extensions: https://bugs.php.net/fix.php?id=68264&r=nozend MySQL Configuration Error: https://bugs.php.net/fix.php?id=68264&r=mysqlcfg

« previous php.bugs (#188187) next »