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->exec('DROP TABLE testz');
13$dbh->exec('CREATE TABLE testz(A VARCHAR(30), B VARCHAR(30), C VARCHAR(30))');
14$dbh->exec("INSERT INTO testz VALUES ('A', 'B', 'C')");
15$dbh->commit();
16
17$stmt1 = "SELECT B FROM testz WHERE A = ? AND B = ?";
18$stmt2 = "SELECT B, C FROM testz WHERE A = ? AND B = ?";
19
20$stmth2 = $dbh->prepare($stmt2);
21$stmth2->execute(array('A', 'B'));
22$rows = $stmth2->fetchAll(); // <------ OK
23var_dump($rows);
24
25$stmth1 = $dbh->prepare($stmt1);
26$stmth1->execute(array('A', 'B'));
27$rows = $stmth1->fetchAll(); // <------- segfault
28var_dump($rows);
29
30$dbh->commit();
31unset($stmth1);
32unset($stmth2);
33
34$dbh->exec('DROP TABLE testz');
35
36unset($stmt);
37unset($dbh);
38
39?>
40--EXPECT--
41array(1) {
42  [0]=>
43  array(4) {
44    ["B"]=>
45    string(1) "B"
46    [0]=>
47    string(1) "B"
48    ["C"]=>
49    string(1) "C"
50    [1]=>
51    string(1) "C"
52  }
53}
54array(1) {
55  [0]=>
56  array(2) {
57    ["B"]=>
58    string(1) "B"
59    [0]=>
60    string(1) "B"
61  }
62}
63