1--TEST-- 2PDO_Firebird: bug 53280 segfaults if query column count is less than param count 3--EXTENSIONS-- 4pdo_firebird 5--SKIPIF-- 6<?php require('skipif.inc'); ?> 7--XLEAK-- 8A bug in firebird causes a memory leak when calling `isc_attach_database()`. 9See https://github.com/FirebirdSQL/firebird/issues/7849 10--FILE-- 11<?php 12 13require("testdb.inc"); 14 15$dbh = getDbConnection(); 16$dbh->exec('CREATE TABLE test53280(A VARCHAR(30), B VARCHAR(30), C VARCHAR(30))'); 17$dbh->exec("INSERT INTO test53280 VALUES ('A', 'B', 'C')"); 18 19$stmt1 = "SELECT B FROM test53280 WHERE A = ? AND B = ?"; 20$stmt2 = "SELECT B, C FROM test53280 WHERE A = ? AND B = ?"; 21 22$stmth2 = $dbh->prepare($stmt2); 23$stmth2->execute(array('A', 'B')); 24$rows = $stmth2->fetchAll(); // <------ OK 25var_dump($rows); 26 27$stmth1 = $dbh->prepare($stmt1); 28$stmth1->execute(array('A', 'B')); 29$rows = $stmth1->fetchAll(); // <------- segfault 30var_dump($rows); 31 32unset($stmth1); 33unset($stmth2); 34unset($stmt); 35unset($dbh); 36 37?> 38--CLEAN-- 39<?php 40require 'testdb.inc'; 41$dbh = getDbConnection(); 42@$dbh->exec("DROP TABLE test53280"); 43unset($dbh); 44?> 45--EXPECT-- 46array(1) { 47 [0]=> 48 array(4) { 49 ["B"]=> 50 string(1) "B" 51 [0]=> 52 string(1) "B" 53 ["C"]=> 54 string(1) "C" 55 [1]=> 56 string(1) "C" 57 } 58} 59array(1) { 60 [0]=> 61 array(2) { 62 ["B"]=> 63 string(1) "B" 64 [0]=> 65 string(1) "B" 66 } 67} 68