com php-src: Fix #76665: SQLite3Stmt::bindValue() with SQLITE3_FLOAT doesn't juggle: NEWS ext/sqlite 3/sqlite3.c ext/sqlite3/tests/bug76665.ph pt

From: Date: Thu, 26 Jul 2018 11:15:19 +0000
Subject: com php-src: Fix #76665: SQLite3Stmt::bindValue() with SQLITE3_FLOAT doesn't juggle: NEWS ext/sqlite 3/sqlite3.c ext/sqlite3/tests/bug76665.ph pt
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-102692@lists.php.net to get a copy of this message
Commit: ed7e3bc70a89a0838a5b7e44928cbd65aec50bb1 Author: Christoph M. Becker <cmbecker69@gmx.de> Thu, 26 Jul 2018 13:15:19 +0200 Parents: 40bd84d3e3d3fefdc16c10319e35fcfea359054a Branches: PHP-7.1 PHP-7..2 master Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=ed7e3bc70a89a0838a5b7e44928cbd65aec50bb1 Log: Fix #76665: SQLite3Stmt::bindValue() with SQLITE3_FLOAT doesn't juggle We need to ensure that a zval IS_DOUBLE before we access it as such. In this case we apply common type juggling to do so. Bugs: https://bugs.php.net/76665 Changed paths: M NEWS M ext/sqlite3/sqlite3.c A ext/sqlite3/tests/bug76665.phpt Diff: diff --git a/NEWS b/NEWS index f3bc056..87402d9 100644 --- a/NEWS +++ b/NEWS @@ -13,6 +13,10 @@ PHP NEWS - PDO_Firebird: . Fixed bug #76488 (Memory leak when fetching a BLOB field). (Simonov Denis) +- SQLite3: + . Fixed #76665 (SQLite3Stmt::bindValue() with SQLITE3_FLOAT doesn't juggle). + (cmb) + - Standard: . Fixed bug #68553 (array_column: null values in $index_key become incrementing keys in result). (Laruence) diff --git a/ext/sqlite3/sqlite3.c b/ext/sqlite3/sqlite3.c index 40406ee..6894089 100644 --- a/ext/sqlite3/sqlite3.c +++ b/ext/sqlite3/sqlite3.c @@ -1562,7 +1562,7 @@ PHP_METHOD(sqlite3stmt, execute) break; case SQLITE_FLOAT: - /* convert_to_double(parameter);*/ + convert_to_double(parameter); sqlite3_bind_double(stmt_obj->stmt, param->param_number, Z_DVAL_P(parameter)); break; diff --git a/ext/sqlite3/tests/bug76665.phpt b/ext/sqlite3/tests/bug76665.phpt new file mode 100644 index 0000000...0e1de13 --- /dev/null +++ b/ext/sqlite3/tests/bug76665.phpt @@ -0,0 +1,19 @@ +--TEST-- +Bug #76665 (SQLite3Stmt::bindValue() with SQLITE3_FLOAT doesn't juggle) +--SKIPIF-- +<?php +if (!extension_loaded('sqlite3')) die('skip sqlite3 extension not available'); +?> +--FILE-- +<?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")); +?> +===DONE=== +--EXPECT-- +float(17) +===DONE===

« previous php.cvs (#102692) next »