xref: /PHP-7.4/ext/sqlite3/tests/bug73333.phpt (revision 3f72c77c)
1--TEST--
2Bug #73333 (2147483647 is fetched as string)
3--SKIPIF--
4<?php
5if (!extension_loaded('sqlite3')) die('skip sqlite3 extension not available');
6?>
7--FILE--
8<?php
9if (!defined('PHP_INT_MIN')) define('PHP_INT_MIN', -PHP_INT_MAX-1);
10
11$db = new SQLite3(':memory:');
12$db->exec('CREATE TABLE foo (bar INT)');
13foreach ([PHP_INT_MIN, PHP_INT_MAX] as $value) {
14    $db->exec("INSERT INTO foo VALUES ($value)");
15}
16
17$res = $db->query('SELECT bar FROM foo');
18while (($row = $res->fetchArray(SQLITE3_NUM)) !== false) {
19    echo gettype($row[0]), PHP_EOL;
20}
21?>
22===DONE===
23--EXPECT--
24integer
25integer
26===DONE===
27