1
0
mirror of https://github.com/php/php-src.git synced 2026-04-30 03:33:17 +02:00
Files
archived-php-src/ext/pdo_sqlite/tests/bug_63916.phpt
T
Nikita Popov 438b025a28 Support native types in PDO SQLite
Return integers and floats as native types if possible. As usual,
the old behavior can be restored by enabling ATTR_STRINGIFY_FETCHES.

Fixes bug #38334.
2020-12-23 11:25:31 +01:00

28 lines
760 B
PHP

--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)
int(100004313234244)