1--TEST-- 2PDO_Firebird: bug 53280 segfaults if query column count is less than param count 3--SKIPIF-- 4<?php require('skipif.inc'); ?> 5--ENV-- 6LSAN_OPTIONS=detect_leaks=0 7--FILE-- 8<?php 9 10require("testdb.inc"); 11 12$dbh->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_SILENT); 13@$dbh->exec('DROP TABLE testz'); 14$dbh->exec('CREATE TABLE testz(A VARCHAR(30), B VARCHAR(30), C VARCHAR(30))'); 15$dbh->exec("INSERT INTO testz VALUES ('A', 'B', 'C')"); 16$dbh->commit(); 17 18$stmt1 = "SELECT B FROM testz WHERE A = ? AND B = ?"; 19$stmt2 = "SELECT B, C FROM testz WHERE A = ? AND B = ?"; 20 21$stmth2 = $dbh->prepare($stmt2); 22$stmth2->execute(array('A', 'B')); 23$rows = $stmth2->fetchAll(); // <------ OK 24var_dump($rows); 25 26$stmth1 = $dbh->prepare($stmt1); 27$stmth1->execute(array('A', 'B')); 28$rows = $stmth1->fetchAll(); // <------- segfault 29var_dump($rows); 30 31$dbh->commit(); 32unset($stmth1); 33unset($stmth2); 34 35$dbh->exec('DROP TABLE testz'); 36 37unset($stmt); 38unset($dbh); 39 40?> 41--EXPECT-- 42array(1) { 43 [0]=> 44 array(4) { 45 ["B"]=> 46 string(1) "B" 47 [0]=> 48 string(1) "B" 49 ["C"]=> 50 string(1) "C" 51 [1]=> 52 string(1) "C" 53 } 54} 55array(1) { 56 [0]=> 57 array(2) { 58 ["B"]=> 59 string(1) "B" 60 [0]=> 61 string(1) "B" 62 } 63} 64