bug66550.phpt 584 B

1234567891011121314151617181920212223
  1. --TEST--
  2. Bug #66550 (SQLite prepared statement use-after-free)
  3. --EXTENSIONS--
  4. sqlite3
  5. --FILE--
  6. <?php
  7. $db = new SQLite3(':memory:');
  8. $db->exec('CREATE TABLE foo (id INTEGER, bar STRING)');
  9. $stmt = $db->prepare('SELECT bar FROM foo WHERE id=:id');
  10. // Close the database connection and free the internal sqlite3_stmt object
  11. $db->close();
  12. // Access the sqlite3_stmt object via the php_sqlite3_stmt container
  13. try {
  14. $stmt->reset();
  15. } catch (\Error $e) {
  16. echo $e->getMessage() . \PHP_EOL;
  17. }
  18. ?>
  19. --EXPECT--
  20. The SQLite3 object has not been correctly initialised or is already closed