Bug #76665 [Csd]: SQLite3Stmt::bindValue() with SQLITE3_FLOAT doesn't juggle

From: Date: Thu, 26 Jul 2018 12:26:09 +0000
Subject: Bug #76665 [Csd]: SQLite3Stmt::bindValue() with SQLITE3_FLOAT doesn't juggle
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-216476@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=76665&edit=1 ID: 76665 Updated by: cmb@php.net Reported by: cmb@php.net Summary: SQLite3Stmt::bindValue() with SQLITE3_FLOAT doesn't juggle Status: Closed Type: Bug Package: SQLite related Operating System: * PHP Version: 7.2.8 -Assigned To: +Assigned To: cmb Block user comment: N Private report: N New Comment: Thanks, Anatol! Previous Comments: ------------------------------------------------------------------------ [2018-07-26 12:25:25] cmb@php.net Automatic comment on behalf of cmbecker69@gmx.de Revision: http://git.php.net/?p=php-src.git;a=commit;h=ed7e3bc70a89a0838a5b7e44928cbd65aec50bb1 Log: Fix #76665: SQLite3Stmt::bindValue() with SQLITE3_FLOAT doesn't juggle ------------------------------------------------------------------------ [2018-07-26 09:53:47] ab@php.net You got it, Christoph. Looks like just uncommenting it and adding test should be fine for 7.1. thanks. ------------------------------------------------------------------------ [2018-07-25 17:25:00] cmb@php.net Description: ------------ If SQLite3Stmt::bindValue() is called with the explicit $type SQLITE3_FLOAT, and a $value which is not a float, garbage is written to the database in the best case. For some reason the respective conversion to double[1] is commented out since ext/sqlite3 has been moved to php-src (and actually has been commented out at least since PECL/sqlite3 version 0.3). [1] <https://github.com/php/php-src/blob/php-7.2.8/ext/sqlite3/sqlite3.c#L1598> Test script: --------------- <?php $db = new SQLite3('memory'); $db->exec("CREATE TABLE foo (bar REAL)"); $stmt = $db->prepare("INSERT INTO foo VALUES (:bar)"); $stmt->bindValue(':bar', 17, SQLITE3_FLOAT); $stmt->execute(); var_dump($db->querySingle("SELECT bar FROM foo LIMIT 1")); Expected result: ---------------- float(17) Actual result: -------------- float(8.3991159793012E-323) ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=76665&edit=1

« previous php.bugs (#216476) next »