Annotation of embedaddon/php/ext/pdo_firebird/tests/bug_53280.phpt, revision 1.1.1.2
1.1 misho 1: --TEST--
2: PDO_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: --FILE--
6: <?php
7:
8: require("testdb.inc");
9:
10: $dbh = new PDO("firebird:dbname=$test_base",$user,$password) or die;
11: $value = '2';
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
23: var_dump($rows);
24:
25: $stmth1 = $dbh->prepare($stmt1);
26: $stmth1->execute(array('A', 'B'));
27: $rows = $stmth1->fetchAll(); // <------- segfault
28: var_dump($rows);
29:
30: $dbh->commit();
1.1.1.2 ! misho 31: unset($stmth1);
! 32: unset($stmth2);
1.1 misho 33:
34: $dbh->exec('DROP TABLE testz');
35:
36: unset($stmt);
37: unset($dbh);
38:
39: ?>
40: --EXPECT--
41: array(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: }
54: array(1) {
55: [0]=>
56: array(2) {
57: ["B"]=>
58: string(1) "B"
59: [0]=>
60: string(1) "B"
61: }
62: }
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>