From: googleguy Operating system: PHP version: 5.4.10 Package: SQLite related Bug Type: Bug Bug description:sqlite3::bindvalue and relative PHP functions aren't using sqlite3_*_int64 API
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 bug report at https://bugs.php.net/bug.php?id=63921&edit=1 -- Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=63921&r=trysnapshot54 Try a snapshot (PHP 5.3): https://bugs.php.net/fix.php?id=63921&r=trysnapshot53 Try a snapshot (trunk): https://bugs.php.net/fix.php?id=63921&r=trysnapshottrunk Fixed in SVN: https://bugs.php.net/fix.php?id=63921&r=fixed Fixed in release: https://bugs.php.net/fix.php?id=63921&r=alreadyfixed Need backtrace: https://bugs.php.net/fix.php?id=63921&r=needtrace Need Reproduce Script: https://bugs.php.net/fix.php?id=63921&r=needscript Try newer version: https://bugs.php.net/fix.php?id=63921&r=oldversion Not developer issue: https://bugs.php.net/fix.php?id=63921&r=support Expected behavior: https://bugs.php.net/fix.php?id=63921&r=notwrong Not enough info: https://bugs.php.net/fix.php?id=63921&r=notenoughinfo Submitted twice: https://bugs.php.net/fix.php?id=63921&r=submittedtwice register_globals: https://bugs.php.net/fix.php?id=63921&r=globals PHP 4 support discontinued: https://bugs.php.net/fix.php?id=63921&r=php4 Daylight Savings: https://bugs.php.net/fix.php?id=63921&r=dst IIS Stability: https://bugs.php.net/fix.php?id=63921&r=isapi Install GNU Sed: https://bugs.php.net/fix.php?id=63921&r=gnused Floating point limitations: https://bugs.php.net/fix.php?id=63921&r=float No Zend Extensions: https://bugs.php.net/fix.php?id=63921&r=nozend MySQL Configuration Error: https://bugs.php.net/fix.php?id=63921&r=mysqlcfg