Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix bug #63916: PDO::PARAM_INT casts to 32bit int internally even on …
…64bit builds in pdo_sqlite
- Loading branch information
Showing
4 changed files
with
64 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
--TEST-- | ||
Bug #63916 PDO::PARAM_INT casts to 32bit int internally even on 64bit builds in pdo_sqlite | ||
--SKIPIF-- | ||
<?php | ||
if (!extension_loaded('pdo_sqlite')) die('skip'); | ||
if (PHP_INT_SIZE > 4) die('skip'); | ||
?> | ||
--FILE-- | ||
<?php | ||
$num = PHP_INT_MAX; // 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); | ||
|
||
var_dump($num,$result[0]); | ||
|
||
?> | ||
--EXPECT-- | ||
int(2147483647) | ||
string(10) "2147483647" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
--TEST-- | ||
Bug #63916 PDO::PARAM_INT casts to 32bit int internally even on 64bit builds in pdo_sqlite | ||
--SKIPIF-- | ||
<?php | ||
if (!extension_loaded('pdo_sqlite')) die('skip'); | ||
if (PHP_INT_SIZE < 8) die('skip'); | ||
?> | ||
--FILE-- | ||
<?php | ||
$num = 100004313234244; // 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); | ||
|
||
var_dump($num,$result[0]); | ||
|
||
?> | ||
--EXPECT-- | ||
int(100004313234244) | ||
string(15) "100004313234244" |