1--TEST-- 2Bug #77051 SQLite3::bindParam memory bug when missing ::reset call 3--SKIPIF-- 4<?php require_once(__DIR__ . '/skipif.inc'); ?> 5--FILE-- 6<?php 7 8$db = new SQLite3(':memory:'); 9$db->enableExceptions(true); 10 11$stmt = $db->prepare('SELECT :a, :b, ?;'); 12 13$a = 42; 14$stmt->bindParam(':a', $a, SQLITE3_INTEGER); 15$stmt->bindValue(':b', 'php'); 16$stmt->bindValue(':b', 'PHP'); 17$stmt->bindValue(3, 424242); 18 19echo "Execute statement\n"; 20var_dump($res = $stmt->execute()); 21 22echo "Statement result\n"; 23var_dump($res->fetchArray(SQLITE3_NUM)); 24 25echo "Change binded param to wrong type\n"; 26$a = 'TEST'; 27 28echo "Execute statement\n"; 29var_dump($res = $stmt->execute()); 30 31echo "Statement result\n"; 32var_dump($res->fetchArray(SQLITE3_NUM)); 33 34echo "Change binded values\n"; 35$a = 5252552; 36$stmt->bindValue(':b', 'TEST'); 37$stmt->bindValue(3, '!!!'); 38 39echo "Execute statement\n"; 40var_dump($res = $stmt->execute()); 41 42echo "Statement result\n"; 43var_dump($res->fetchArray(SQLITE3_NUM)); 44 45?> 46--EXPECT-- 47Execute statement 48object(SQLite3Result)#3 (0) { 49} 50Statement result 51array(3) { 52 [0]=> 53 int(42) 54 [1]=> 55 string(3) "PHP" 56 [2]=> 57 int(424242) 58} 59Change binded param to wrong type 60Execute statement 61object(SQLite3Result)#4 (0) { 62} 63Statement result 64array(3) { 65 [0]=> 66 int(0) 67 [1]=> 68 string(3) "PHP" 69 [2]=> 70 int(424242) 71} 72Change binded values 73Execute statement 74object(SQLite3Result)#3 (0) { 75} 76Statement result 77array(3) { 78 [0]=> 79 int(5252552) 80 [1]=> 81 string(4) "TEST" 82 [2]=> 83 string(3) "!!!" 84}