Bug #63921 [Csd->Fbk]: sqlite3::bindvalue and relative PHP functions aren't using sqlite3_*_int64 API
| From: | lstrojny@php.net | Date: | Mon, 14 Jan 2013 16:36:35 +0000 |
| Subject: | Bug #63921 [Csd->Fbk]: sqlite3::bindvalue and relative PHP functions aren't using sqlite3_*_int64 API | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-176004@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=63921&edit=1
ID: 63921
Updated by: lstrojny@php.net
Reported by: googleguy@php.net
Summary: sqlite3::bindvalue and relative PHP functions aren't
using sqlite3_*_int64 API
-Status: Closed
+Status: Feedback
Type: Bug
Package: SQLite related
PHP Version: 5.4.10
Block user comment: N
Private report: N
New Comment:
Please try using this snapshot:
http://snaps.php.net/php5.4-latest.tar.gz
For Windows:
http://windows.php.net/snapshots/
Previous Comments:
------------------------------------------------------------------------
[2013-01-14 16:35:42] lstrojny@php.net
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
------------------------------------------------------------------------
[2013-01-06 18:49:11] googleguy@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] googleguy@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