1
0
mirror of https://github.com/php/php-src.git synced 2026-04-13 19:14:16 +02:00
Files
archived-php-src/ext/sqlite3/tests/bug73530.phpt
Christoph M. Becker eb570294a2 Fix #73530: Unsetting result set may reset other result set
Calling sqlite3_reset() when a result set object is freed can cause
undesired and maybe even hard to track interference with other result
sets. Furthermore, there is no need to call sqlite3_reset(), because
that is implicitly called on SQLite3Stmt::execute(), and users are
encouraged to explicitly call either SQLite3Result::finalize() or
SQLite3Stmt::reset() anyway.
2016-11-16 11:49:04 +01:00

33 lines
772 B
PHP

--TEST--
Bug #73530 (Unsetting result set may reset other result set)
--SKIPIF--
<?php
if (!extension_loaded('sqlite3')) die('skip sqlite3 extension not available');
?>
--FILE--
<?php
$db = new SQLite3(':memory:');
$db->exec("CREATE TABLE foo (num int)");
$db->exec("INSERT INTO foo VALUES (0)");
$db->exec("INSERT INTO foo VALUES (1)");
$stmt = $db->prepare("SELECT * FROM foo WHERE NUM = ?");
$stmt->bindValue(1, 0, SQLITE3_INTEGER);
$res1 = $stmt->execute();
$res1->finalize();
$stmt->clear();
$stmt->reset();
$stmt->bindValue(1, 1, SQLITE3_INTEGER);
$res2 = $stmt->execute();
while ($row = $res2->fetchArray(SQLITE3_ASSOC)) {
var_dump($row);
unset($res1);
}
?>
===DONE===
--EXPECT--
array(1) {
["num"]=>
int(1)
}
===DONE===