xref: /PHP-7.3/ext/sqlite3/tests/bug79294.phpt (revision f133f002)
1--TEST--
2Bug #79294 ()::columnType() may fail after SQLite3Stmt::reset())
3--SKIPIF--
4<?php
5if (!extension_loaded('sqlite3')) die('sqlite3 extension not available');
6?>
7--FILE--
8<?php
9$db = new SQLite3(':memory:');
10$db->exec("CREATE TABLE foo (bar INT)");
11$db->exec("INSERT INTO foo VALUES (1)");
12
13$stmt = $db->prepare("SELECT * FROM foo");
14$res = $stmt->execute();
15var_dump($res->fetchArray() !== false);
16var_dump($res->columnType(0));
17var_dump($res->fetchArray() !== false);
18var_dump($res->columnType(0));
19$stmt->reset();
20var_dump($res->fetchArray() !== false);
21var_dump($res->columnType(0));
22$res->reset();
23var_dump($res->fetchArray() !== false);
24var_dump($res->columnType(0));
25?>
26--EXPECT--
27bool(true)
28int(1)
29bool(false)
30bool(false)
31bool(true)
32int(1)
33bool(true)
34int(1)
35