1--TEST-- 2Bug #70628 (Clearing bindings on an SQLite3 statement doesn't work) 3--SKIPIF-- 4<?php 5if (!extension_loaded('sqlite3')) die('skip'); ?> 6--FILE-- 7<?php 8$db = new SQLite3(':memory:'); 9 10$db->exec("CREATE TABLE Dogs (Id INTEGER PRIMARY KEY, Breed TEXT, Name TEXT, Age INTEGER)"); 11 12$sth = $db->prepare("INSERT INTO Dogs (Breed, Name, Age) VALUES (:breed,:name,:age)"); 13 14$sth->bindValue(':breed', 'canis', SQLITE3_TEXT); 15$sth->bindValue(':name', 'jack', SQLITE3_TEXT); 16$sth->bindValue(':age', 7, SQLITE3_INTEGER); 17$sth->execute(); 18 19$sth->clear(); 20$sth->reset(); 21 22$sth->bindValue(':breed', 'russel', SQLITE3_TEXT); 23$sth->bindValue(':age', 3, SQLITE3_INTEGER); 24$sth->execute(); 25 26$res = $db->query('SELECT * FROM Dogs'); 27while (($row = $res->fetchArray(SQLITE3_ASSOC))) { 28 var_dump($row); 29} 30$res->finalize(); 31 32$sth->close(); 33$db->close(); 34?> 35--EXPECT-- 36array(4) { 37 ["Id"]=> 38 int(1) 39 ["Breed"]=> 40 string(5) "canis" 41 ["Name"]=> 42 string(4) "jack" 43 ["Age"]=> 44 int(7) 45} 46array(4) { 47 ["Id"]=> 48 int(2) 49 ["Breed"]=> 50 string(6) "russel" 51 ["Name"]=> 52 NULL 53 ["Age"]=> 54 int(3) 55} 56