summaryrefslogtreecommitdiff
path: root/ext/sqlite3/tests/bug63921-32bit.phpt
blob: 8c1c6b9414cbe85a29e038710d26df7f937bd51f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
--TEST--
Bug #63921 sqlite3::bindvalue and relative PHP functions aren't using sqlite3_*_int64 API
--SKIPIF--
<?php
if (!extension_loaded('sqlite3')) die('skip');
if (PHP_INT_SIZE > 4) die('skip'); // skip for 64bit builds - there is another test for that
?>
--FILE--
<?php
$num = PHP_INT_MAX; // 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();

var_dump($num,$result[0]);

?>
--EXPECT--
int(2147483647)
string(10) "2147483647"