1--TEST--
2PDO_Firebird: bug 53280 segfaults if query column count is less than param count
3--SKIPIF--
4<?php extension_loaded("pdo_firebird") or die("skip"); ?>
5<?php function_exists("ibase_query") or die("skip"); ?>
6--FILE--
7<?php
8
9require("testdb.inc");
10
11$dbh = new PDO("firebird:dbname=$test_base",$user,$password) or die;
12$value = '2';
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