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