From: googleguy
Operating system:
PHP version: 5.4.10
Package: PDO related
Bug Type: Bug
Bug description:PDO::PARAM_INT casts to 32bit int internally even on 64bit
builds in pdo_sqlie
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
--
Edit bug report at https://bugs.php.net/bug.php?id=63916&edit=1
--
Try a snapshot (PHP 5.4):
https://bugs.php.net/fix.php?id=63916&r=trysnapshot54
Try a snapshot (PHP 5.3):
https://bugs.php.net/fix.php?id=63916&r=trysnapshot53
Try a snapshot (trunk):
https://bugs.php.net/fix.php?id=63916&r=trysnapshottrunk
Fixed in SVN: https://bugs.php.net/fix.php?id=63916&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=63916&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=63916&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=63916&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=63916&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=63916&r=support
Expected behavior: https://bugs.php.net/fix.php?id=63916&r=notwrong
Not enough info:
https://bugs.php.net/fix.php?id=63916&r=notenoughinfo
Submitted twice:
https://bugs.php.net/fix.php?id=63916&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=63916&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=63916&r=php4
Daylight Savings: https://bugs.php.net/fix.php?id=63916&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=63916&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=63916&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=63916&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=63916&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=63916&r=mysqlcfg