summaryrefslogtreecommitdiff
path: root/ext/sqlite3/tests/bug66550.phpt
diff options
context:
space:
mode:
Diffstat (limited to 'ext/sqlite3/tests/bug66550.phpt')
-rw-r--r--ext/sqlite3/tests/bug66550.phpt23
1 files changed, 23 insertions, 0 deletions
diff --git a/ext/sqlite3/tests/bug66550.phpt b/ext/sqlite3/tests/bug66550.phpt
new file mode 100644
index 0000000000..a44515b0d9
--- /dev/null
+++ b/ext/sqlite3/tests/bug66550.phpt
@@ -0,0 +1,23 @@
+--TEST--
+Bug #66550 (SQLite prepared statement use-after-free)
+--SKIPIF--
+<?php
+if (!extension_loaded('sqlite3')) die('skip');
+?>
+--FILE--
+<?php
+
+$db = new SQLite3(':memory:');
+
+$db->exec('CREATE TABLE foo (id INTEGER, bar STRING)');
+
+$stmt = $db->prepare('SELECT bar FROM foo WHERE id=:id');
+// Close the database connection and free the internal sqlite3_stmt object
+$db->close();
+// Access the sqlite3_stmt object via the php_sqlite3_stmt container
+$stmt->reset();
+?>
+==DONE==
+--EXPECTF--
+Warning: SQLite3Stmt::reset(): The SQLite3 object has not been correctly initialised in %s
+==DONE==