Edit report at https://bugs.php.net/bug.php?id=63921&edit=1
ID: 63921 Updated by: lstro...@php.net Reported by: google...@php.net Summary: sqlite3::bindvalue and relative PHP functions aren't using sqlite3_*_int64 API -Status: Open +Status: Closed Type: Bug Package: SQLite related PHP Version: 5.4.10 Block user comment: N Private report: N New Comment: Automatic comment on behalf of lstrojny Revision: http://git.php.net/?p=php-src.git;a=commit;h=99d087e5d437023c55f96dcde4b5b784bd8b0ac8 Log: Fixed bug #63921: sqlite3::bindvalue and relative PHP functions aren't using sqlite3_*_int64 API Previous Comments: ------------------------------------------------------------------------ [2013-01-06 18:49:11] google...@php.net I've sent a PR for this as well on master. I hope to get it merged into 5.3.NEXT, 5.4.NEXT, and 5.5.NEXT for consistency with the fix for bug #63916 as they are both related to sqlite3 driver. https://github.com/php/php-src/pull/254 ------------------------------------------------------------------------ [2013-01-06 17:24:52] google...@php.net Description: ------------ The sqlite3::bindvalue and relative PHP functions aren't using sqlite3_*_int64 API functions internally or checking for a 64 bit build to do so. As a result using SQLITE3_INTEGER constants in calls to bindValue cause internal cast to 32 bit int. This is unexpected behavior and the API calls exist internally sqlite3. This is also related to bug #63916 which I also patched. I'm providing an additional patch for ext/sqlite3 in relation for the same bug. Test script: --------------- $num = 100004313234244; // notice this exceeds 32 bits $conn = new sqlite3(':memory:'); $conn->query('CREATE TABLE users (id INTEGER NOT NULL, num INTEGER NOT NULL, PRIMARY KEY(id))'); $stmt = $conn->prepare('insert into users (id, num) values (:id, :num)'); $stmt->bindValue(':id', 1, SQLITE3_INTEGER); $stmt->bindValue(':num', $num, SQLITE3_INTEGER); $stmt->execute(); $stmt = $conn->query('SELECT num FROM users'); $result = $stmt->fetchArray(); printf("Expected: %d Received: %d\n", $num, $result[0]); Expected result: ---------------- Expected: 100004313234244 Received: 100004313234244 Actual result: -------------- Expected: 100004313234244 Received: 294714180 ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=63921&edit=1