xref: /PHP-7.1/ext/pdo_sqlite/tests/bug_63916.phpt (revision 1e9a3ed2)
1--TEST--
2Bug #63916 PDO::PARAM_INT casts to 32bit int internally even on 64bit builds in pdo_sqlite
3--SKIPIF--
4<?php
5if (!extension_loaded('pdo_sqlite')) die('skip');
6if (PHP_INT_SIZE < 8) die('skip');
7?>
8--FILE--
9<?php
10$num = 100004313234244; // exceeds 32 bits
11$conn = new PDO('sqlite::memory:');
12$conn->query('CREATE TABLE users (id INTEGER NOT NULL, num INTEGER NOT NULL, PRIMARY KEY(id))');
13
14$stmt = $conn->prepare('insert into users (id, num) values (:id, :num)');
15$stmt->bindValue(':id', 1, PDO::PARAM_INT);
16$stmt->bindValue(':num', $num, PDO::PARAM_INT);
17$stmt->execute();
18
19$stmt = $conn->query('SELECT num FROM users');
20$result = $stmt->fetchAll(PDO::FETCH_COLUMN);
21
22var_dump($num,$result[0]);
23
24?>
25--EXPECT--
26int(100004313234244)
27string(15) "100004313234244"
28