|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2013-01-06 05:22 UTC] googleguy@php.net
-Summary: PDO::PARAM_INT casts to 32bit int internally even on
64bit builds in pdo_sqlie
+Summary: PDO::PARAM_INT casts to 32bit int internally even on
64bit builds in pdo_sqlite
[2013-01-06 12:57 UTC] googleguy@php.net
[2013-01-12 22:03 UTC] googleguy@php.net
[2013-01-14 16:59 UTC] lstrojny@php.net
[2013-01-14 16:59 UTC] lstrojny@php.net
-Status: Open
+Status: Closed
[2013-01-14 17:00 UTC] lstrojny@php.net
[2013-01-14 17:00 UTC] lstrojny@php.net
-Status: Closed
+Status: Feedback
[2013-01-14 17:16 UTC] lstrojny@php.net
[2013-01-14 17:16 UTC] lstrojny@php.net
-Status: Feedback
+Status: Closed
[2013-01-14 17:17 UTC] lstrojny@php.net
[2014-10-07 23:20 UTC] stas@php.net
[2014-10-07 23:31 UTC] stas@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Thu Oct 30 02:00:01 2025 UTC |
Description: ------------ Binding a PDO parameter with pdo_sqlite on 64bit builds with PDO::PARAM_INT forces the param to be cast internally to an int. This means 64bit ints will be cast down to 32bit ints internally even if PHP was compiled against a 64bit arch. Test script: --------------- $num = 100004313234244; // notice this exceeds 32 bits $conn = new PDO('sqlite::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, PDO::PARAM_INT); $stmt->bindValue(':num', $num, PDO::PARAM_INT); $stmt->execute(); $stmt = $conn->query('SELECT num FROM users'); $result = $stmt->fetchAll(PDO::FETCH_COLUMN); printf("Expected: %d Received: %d\n", $num, $result[0]); Expected result: ---------------- // expected to output Expected: 100004313234244 Received: 100004313234244 Actual result: -------------- // instead we get output of Expected: 100004313234244 Received: 294714180