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