xref: /PHP-7.1/ext/sqlite3/tests/bug66550.phpt (revision 5ae20c62)
1--TEST--
2Bug #66550 (SQLite prepared statement use-after-free)
3--SKIPIF--
4<?php
5if (!extension_loaded('sqlite3')) die('skip');
6?>
7--FILE--
8<?php
9
10$db = new SQLite3(':memory:');
11
12$db->exec('CREATE TABLE foo (id INTEGER, bar STRING)');
13
14$stmt = $db->prepare('SELECT bar FROM foo WHERE id=:id');
15// Close the database connection and free the internal sqlite3_stmt object
16$db->close();
17// Access the sqlite3_stmt object via the php_sqlite3_stmt container
18$stmt->reset();
19?>
20==DONE==
21--EXPECTF--
22Warning: SQLite3Stmt::reset(): The SQLite3 object has not been correctly initialised in %s
23==DONE==
24